Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 2
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (dgHeaderBKK.SelectedCells[0].OwningRow.Cells["Src"].Value.ToString() != "OUT")
            {
                return;
            }

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

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

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

                    DataRow dr = dv.Row;

                    dr.Delete();
                    dtBKK.AcceptChanges();
                    dgHeaderBKK.Focus();
                    dgHeaderBKK.RefreshEdit();
                    if (dgHeaderBKK.RowCount > 0)
                    {
                        if (i == 0)
                        {
                            dgHeaderBKK.CurrentCell = dgHeaderBKK.Rows[0].Cells[n];
                            dgHeaderBKK.RefreshEdit();
                        }
                        else
                        {
                            dgHeaderBKK.CurrentCell = dgHeaderBKK.Rows[i - 1].Cells[n];
                            dgHeaderBKK.RefreshEdit();
                        }
                    }
                    #endregion
                    //di remark
                    //HeaderRefresh();
                    //DetailRefresh();
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }
        }
Exemplo n.º 3
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (dgHeaderBKM.SelectedCells[0].OwningRow.Cells["Src"].Value.ToString() != "IN")
            {
                return;
            }

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

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

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

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

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

                    DataRow dr = dv.Row;

                    dr.Delete();
                    dtBKM.AcceptChanges();
                    dgHeaderBKM.Focus();
                    dgHeaderBKM.RefreshEdit();
                    if (dgHeaderBKM.RowCount > 0)
                    {
                        if (i == 0)
                        {
                            dgHeaderBKM.CurrentCell = dgHeaderBKM.Rows[0].Cells[n];
                            dgHeaderBKM.RefreshEdit();
                        }
                        else
                        {
                            dgHeaderBKM.CurrentCell = dgHeaderBKM.Rows[i - 1].Cells[n];
                            dgHeaderBKM.RefreshEdit();
                        }
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
                finally
                {
                    //HeaderRefresh();
                    //DetailRefresh();
                }
            }
        }
Exemplo n.º 4
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (selectedGrid == enumSelectedGrid.DetailSelected)
            {
                if (MessageBox.Show(Messages.Question.AskDelete, "Delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    if (gridPiutang.SelectedCells.Count > 0)
                    {
                        Guid   rowID = (Guid)gridPiutang.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                        string nip   = gridKaryawan.SelectedCells[0].OwningRow.Cells["NIP"].Value.ToString();
                        string Ref   = gridPiutang.SelectedCells[0].OwningRow.Cells["reff"].Value.ToString();

                        DateTime tglPinjam = Convert.ToDateTime(gridPiutang.SelectedCells[0].OwningRow.Cells["Tanggal"].Value);
                        if (GlobalVar.Gudang != "2808")
                        {
                            if (PeriodeClosing.IsKasirClosed(tglPinjam))
                            {
                                MessageBox.Show("Tidak bisa delete, data sudah di closing.");
                                return;
                            }
                        }

                        try
                        {
                            if (Ref == "BKK" || Ref == "BKM")
                            {
                                string    pgwRecordID = gridPiutang.SelectedCells[0].OwningRow.Cells["recordID"].Value.ToString();
                                DataTable dtcek       = new DataTable();
                                using (Database db = new Database(GlobalVar.DBName))
                                {
                                    db.Commands.Add(db.CreateCommand("usp_PinjamanPegawaiInden_CEK"));
                                    db.Commands[0].Parameters.Add(new Parameter("@recordID", SqlDbType.VarChar, pgwRecordID));
                                    dtcek = db.Commands[0].ExecuteDataTable();
                                }
                                if (dtcek.Rows.Count > 0)
                                {
                                    MessageBox.Show("Sudah inden !!, Delete dulu data yang ada di Inden.");
                                    return;
                                }
                                using (Database db = new Database(GlobalVar.DBName))
                                {
                                    db.Commands.Add(db.CreateCommand("usp_PinjamanPegawaiBukti_DELETE"));
                                    db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, rowID));
                                    db.Commands[0].ExecuteNonQuery();
                                }
                                RefreshData(nip);
                            }
                            else if (Ref == "TRK" || Ref == "TRM")
                            {
                                using (Database db = new Database(GlobalVar.DBName))
                                {
                                    db.Commands.Add(db.CreateCommand("usp_PinjamanPegawaiTransfer_DELETE"));
                                    db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, rowID));
                                    db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                                    db.Commands[0].ExecuteNonQuery();
                                }
                                RefreshData(nip);
                            }
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                        finally
                        {
                            //RefreshPegawai(nip);
                            //FindRowPegawsai("NIP", nip);
                            //#region "Tambahan"
                            //int i = 0;
                            //int n = 0;
                            //i = gridPiutang.SelectedCells[0].RowIndex;
                            //n = gridPiutang.SelectedCells[0].ColumnIndex;
                            //DataRowView dv = (DataRowView)gridPiutang.SelectedCells[0].OwningRow.DataBoundItem;

                            //DataRow dr = dv.Row;

                            //dr.Delete();
                            //dtDetail.AcceptChanges();
                            //gridPiutang.Focus();
                            //gridPiutang.RefreshEdit();
                            //if (gridPiutang.RowCount > 0)
                            //{
                            //    if (i == 0)
                            //    {
                            //        gridPiutang.CurrentCell = gridPiutang.Rows[0].Cells[n];
                            //        gridPiutang.RefreshEdit();
                            //    }
                            //    else
                            //    {
                            //        gridPiutang.CurrentCell = gridPiutang.Rows[i - 1].Cells[n];
                            //        gridPiutang.RefreshEdit();
                            //    }

                            //}
                            //#endregion
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (selectedGrid == enumSelectedGrid.HeaderSelected)
            {
                if (gridUtm.SelectedCells.Count > 0)
                {
                    DateTime _Tanggal = (DateTime)gridUtm.SelectedCells[0].OwningRow.Cells["TglBBM"].Value;
                    if (GlobalVar.Gudang != "2808")
                    {
                        if (PeriodeClosing.IsKasirClosed(_Tanggal))
                        {
                            MessageBox.Show("Sudah Closing!");
                            return;
                        }
                    }
                    if (gridDetail.Rows.Count > 0)
                    {
                        MessageBox.Show("Tidak bisa hapus, masih ada data detail !!!");
                        return;
                    }
                    Guid headerID = (Guid)gridUtm.SelectedCells[0].OwningRow.Cells["RowID"].Value;

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

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

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

                        DataRow dr = dv.Row;

                        dr.Delete();
                        dtHeader.AcceptChanges();
                        gridUtm.Focus();
                        gridUtm.RefreshEdit();
                        if (gridUtm.RowCount > 0)
                        {
                            if (i == 0)
                            {
                                gridUtm.CurrentCell = gridUtm.Rows[0].Cells[n];
                                gridUtm.RefreshEdit();
                            }
                            else
                            {
                                gridUtm.CurrentCell = gridUtm.Rows[i - 1].Cells[n];
                                gridUtm.RefreshEdit();
                            }
                        }
                        #endregion
                    }
                }
            }
            if (gridDetail.SelectedCells.Count > 0)
            {
                DateTime _Tanggal = (DateTime)gridUtm.SelectedCells[0].OwningRow.Cells["TglBBM"].Value;
                if (GlobalVar.Gudang != "2808")
                {
                    if (PeriodeClosing.IsKasirClosed(_Tanggal))
                    {
                        MessageBox.Show("Sudah Closing!");
                        return;
                    }
                }
                Guid headerID  = (Guid)gridUtm.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                Guid rowID     = (Guid)gridDetail.SelectedCells[0].OwningRow.Cells["RowIDDetail"].Value;
                Guid rowIDBank = (Guid)gridDetail.SelectedCells[0].OwningRow.Cells["RowIDBank"].Value;
                if (MessageBox.Show(Messages.Question.AskDelete, "Delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        db.BeginTransaction();
                        Class.TransferBank.DeleteDetail(db, rowID);

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

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

                    DataRow dr = dv.Row;

                    dr.Delete();
                    dtDetail.AcceptChanges();
                    gridDetail.Focus();
                    gridDetail.RefreshEdit();
                    if (gridDetail.RowCount > 0)
                    {
                        if (i == 0)
                        {
                            gridDetail.CurrentCell = gridDetail.Rows[0].Cells[n];
                            gridDetail.RefreshEdit();
                        }
                        else
                        {
                            gridDetail.CurrentCell = gridDetail.Rows[i - 1].Cells[n];
                            gridDetail.RefreshEdit();
                        }
                    }
                    #endregion
                }
            }
            else
            {
                MessageBox.Show("Belum Ada Data", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 6
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (tbTanggal.DateValue.ToString() != "" && lookupStafAdm1.Nama != "")
                {
                    TglKasir      = (DateTime)tbTanggal.DateValue;
                    Acc           = lookupStafAdm2.Kode;
                    NamaCollector = lookupStafAdm1.Nama;
                    if (formMode == enumFormMode.New)
                    {
                        if (PeriodeClosing.IsKasirClosed(TglKasir))
                        {
                            MessageBox.Show("Sudah Closing!");
                            return;
                        }
                        noBukti = Numerator.BookNumerator("IND");
                        RowIDI  = Guid.NewGuid();
                        string RecordIDI = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);

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

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


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

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

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



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

                                DataRow dr = dv.Row;

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

                            DataRow dr = dv.Row;

                            dr.Delete();
                            dtDetail.AcceptChanges();
                            gridDetail.Focus();
                            gridDetail.RefreshEdit();
                            if (gridDetail.RowCount > 0)
                            {
                                if (i == 0)
                                {
                                    gridDetail.CurrentCell = gridDetail.Rows[0].Cells[n];
                                    gridDetail.RefreshEdit();
                                }
                                else
                                {
                                    gridDetail.CurrentCell = gridDetail.Rows[i - 1].Cells[n];
                                    gridDetail.RefreshEdit();
                                }
                            }
                            #endregion
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                    }
                }
            }
        }
Exemplo n.º 8
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            if (PeriodeClosing.IsPJTClosed(dateTMT.DateValue.Value))
            {
                MessageBox.Show("Periode Tanggal Sudah Closing");
                return;
            }

            try
            {
                string cGudang = GlobalVar.Gudang;
                switch (formMode)
                {
                case enumFormMode.New:

                    using (Database db = new Database())
                    {
                        _rowID = Guid.NewGuid();
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_HistoryTargetKota_INSERT"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@Kota", SqlDbType.VarChar, txtKota.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@TglAktif", SqlDbType.Date, dateTMT.DateValue.Value));
                        db.Commands[0].Parameters.Add(new Parameter("@KodeGudang", SqlDbType.VarChar, cGudang));
                        db.Commands[0].Parameters.Add(new Parameter("@SKUR2", SqlDbType.Int, txtSkuR2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SKUR4", SqlDbType.Int, txtSkuR4.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SKULain", SqlDbType.Int, txtSkuLain.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFE2", SqlDbType.Money, txtNomFE2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFB2", SqlDbType.Money, txtNomFB2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFE4", SqlDbType.Money, txtNomFE4.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFB4", SqlDbType.Money, txtNomFB4.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFA", SqlDbType.Money, txtNomFA.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFLain", SqlDbType.Money, txtNomFLain.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@OrderAktif", SqlDbType.Int, txtOrdAktif.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@Kunjungan", SqlDbType.Int, txtKunjHarian.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SyncFlag", SqlDbType.VarChar, 0));
                        db.Commands[0].Parameters.Add(new Parameter("@lastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        dt = db.Commands[0].ExecuteDataTable();
                    }
                    break;

                case enumFormMode.Update:
                    using (Database db = new Database())
                    {
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_HistoryTargetKota_UPDATE"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@Kota", SqlDbType.VarChar, txtKota.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@TglAktif", SqlDbType.Date, dateTMT.DateValue.Value));
                        db.Commands[0].Parameters.Add(new Parameter("@KodeGudang", SqlDbType.VarChar, cGudang));
                        db.Commands[0].Parameters.Add(new Parameter("@SKUR2", SqlDbType.Int, txtSkuR2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SKUR4", SqlDbType.Int, txtSkuR4.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SKULain", SqlDbType.Int, txtSkuLain.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFE2", SqlDbType.Money, txtNomFE2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFB2", SqlDbType.Money, txtNomFB2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFE4", SqlDbType.Money, txtNomFE4.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFB4", SqlDbType.Money, txtNomFB4.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFA", SqlDbType.Money, txtNomFA.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFLain", SqlDbType.Money, txtNomFLain.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@OrderAktif", SqlDbType.Int, txtOrdAktif.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@Kunjungan", SqlDbType.Int, txtKunjHarian.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SyncFlag", SqlDbType.VarChar, 0));
                        db.Commands[0].Parameters.Add(new Parameter("@lastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        db.Commands[0].ExecuteNonQuery();
                    }
                    break;
                }
                frmTargetKotaBrowse frm = new frmTargetKotaBrowse();
                frm = (frmTargetKotaBrowse)Caller;
                frm.BindData();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
Exemplo n.º 9
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            Guid RowID;

            try
            {
                string kodeToko = lookupToko.KodeToko;


                /*kendala, toko pt transfernya ke rekening non pt*/
                //if (GlobalVar.Gudang == "2803")
                //{
                //    CekBankPT();
                //    CekTokoPT(kodeToko);
                //    if (cTokoPT == "PT" && cBankPT != "PT")
                //    {
                //        MessageBox.Show("Toko PT harus menggunakan Rekening Bank PT");
                //        return;
                //    }
                //    else if (cTokoPT != "PT" && cBankPT == "PT")
                //    {
                //        MessageBox.Show("Toko Non PT harus menggunakan Rekenig Bank Non PT");
                //        return;
                //    }
                //}

                if (cbNonPiut.Checked == true)
                {
                    if (tbNamaToko.Text == "")
                    {
                        MessageBox.Show("Nama Toko Belum Diisi");
                        tbNamaToko.Focus();
                        return;
                    }
                    if (tbTeidentifikasi.GetDoubleValue > teridentifikasi)
                    {
                        MessageBox.Show("Nominal tidak boleh lebih dari " + teridentifikasi.ToString("#,###"));
                        tbTeidentifikasi.Focus();
                        return;
                    }
                    if (tbTeidentifikasi.GetDoubleValue == 0)
                    {
                        MessageBox.Show("Nominal tidak boleh 0");
                        tbTeidentifikasi.Focus();
                        return;
                    }
                    if (tbTglKasir.Text == "")
                    {
                        MessageBox.Show("Tanggal Kasir Belum Diisi");
                        tbTglKasir.Focus();
                        return;
                    }

                    //ga pengaruh periode closing,, harus >=tglkasir
                    DateTime tglKasir = (DateTime)tbTglKasir.DateValue;
                    if (GlobalVar.Gudang != "2808")
                    {
                        if (PeriodeClosing.IsPJTClosed(tglKasir))
                        {
                            MessageBox.Show("Sudah Closing!");
                            return;
                        }
                    }

                    if (tglKasir < tglKasirInden)
                    {
                        MessageBox.Show("Tanggal Identifikasi Tidak Boleh Lebih Kecil Dari Tanggal Kasir.");
                        return;
                    }
                    string namaToko = tbNamaToko.Text;

                    DateTime tglBPP  = (DateTime)tbTglBPP.DateValue;
                    string   nominal = tbTeidentifikasi.Text;
                    RowID = Guid.NewGuid();
                    Guid   RowIDSup    = Guid.NewGuid();
                    string RecordID    = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);
                    string RecordIDSup = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);

                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        db.BeginTransaction();
                        addIndenSubDetail(db, RowID, RowIDID, RowIDI, RecordID, RecordIDID, "", namaToko, "", "", tglBPP, tglKasir, nominal);
                        addIndenSuperDetail(db, RowIDSup, RowID, RowIDI, RowIDID, RecordIDSup, RecordID, Guid.Empty, "", Guid.Empty, "", "NP", tglBPP, "", chbg, "", tglKasir, (DateTime)SqlDateTime.Null, "", "", "", nominal, "0", "0");
                        db.CommitTransaction();
                    }
                }
                else
                {
                    if (lookupToko.KodeToko == "[CODE]")
                    {
                        MessageBox.Show("Nama Toko Belum Diisi");
                        lookupToko.Focus();
                        return;
                    }

                    if (_KodeTokoDO != "" && kodeToko != _KodeTokoDO)
                    {
                        MessageBox.Show("Tidak bisa identifikasi Toko. Penerimaan uang harus diidentifikasi ke toko " + _NamaTokoDO + " sesuai SO inden no. " + _NoDO + " tgl " + _TglDO.ToString("dd/MM/yyyy") + ". Hubungi manager anda");
                        lookupToko.Focus();
                        return;
                    }

                    if (tbTeidentifikasi.GetDoubleValue > teridentifikasi)
                    {
                        MessageBox.Show("Nominal tidak boleh lebih dari " + teridentifikasi.ToString("#,###"));
                        tbTeidentifikasi.Focus();
                        return;
                    }
                    if (tbTglBPP.Text == "")
                    {
                        MessageBox.Show("Tanggal BPP Belum Diisi");
                        tbTglBPP.Focus();
                        return;
                    }

                    if (tbTglKasir.Text == "")
                    {
                        MessageBox.Show("Tanggal Kasir Belum Diisi");
                        tbTglKasir.Focus();
                        return;
                    }

                    //if (tbNoBPP.Text == "")
                    //{
                    //    MessageBox.Show("No BPP Belum Diisi");
                    //    tbNoBPP.Focus();
                    //    return;
                    //}


                    //tutup sementara ujicoba_______________________________________
                    //if (GlobalVar.Gudang != "2803")
                    //{
                    //    if (tbNoRegister.Text == "")
                    //    {
                    //        MessageBox.Show("No Reg Belum Diisi");
                    //        tbNoRegister.Focus();
                    //        return;
                    //    }
                    //}

                    //ga pengaruh periode closing,, harus >=tglkasir
                    DateTime tglKasir = (DateTime)tbTglKasir.DateValue;
                    if (GlobalVar.Gudang != "2808")
                    {
                        if (PeriodeClosing.IsPJTClosed(tglKasir))
                        {
                            MessageBox.Show("Sudah Closing!");
                            return;
                        }
                    }

                    if (tglKasir < tglKasirInden)
                    {
                        MessageBox.Show("Tanggal Identifikasi Tidak Boleh Lebih Kecil Dari Tanggal Kasir.");
                        return;
                    }

                    string   namaToko = lookupToko.NamaToko;
                    string   codeToko = lookupToko.KodeToko;
                    string   noReg    = tbNoRegister.Text;
                    string   noBPP    = tbNoBPP.Text;
                    DateTime tglBPP   = (DateTime)tbTglBPP.DateValue;
                    string   nominal  = tbTeidentifikasi.Text;
                    RowID = Guid.NewGuid();
                    string RecordID = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);

                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        db.BeginTransaction();
                        addIndenSubDetail(db, RowID, RowIDID, RowIDI, RecordID, RecordIDID, kodeToko, namaToko, noReg, noBPP, tglBPP, tglKasir, nominal);
                        db.Commands.Clear();
                        db.Commands.Add(db.CreateCommand("usp_Giro_UPDATE"));
                        db.Commands[0].Parameters.Add(new Parameter("@GiroID", SqlDbType.UniqueIdentifier, RowIDID));
                        db.Commands[0].Parameters.Add(new Parameter("@KodeToko", SqlDbType.VarChar, codeToko));
                        db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        db.Commands[0].ExecuteNonQuery();
                        db.CommitTransaction();
                    }
                }

                frmPenerimaanBelumTeridentifikasiBrowse frm = new frmPenerimaanBelumTeridentifikasiBrowse();
                frm = (frmPenerimaanBelumTeridentifikasiBrowse)Caller;
                frm.IndenRowRefresh(RowIDI);
                frm.IndenDetailRowRefresh(RowIDID);
                frm.IndenSubDetailRowRefresh(RowID);
                frm.IndenSubDetailFindRow("RowIDISD", RowID.ToString());
                this.Close();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
Exemplo n.º 10
0
        private void tbKepada_Leave(object sender, EventArgs e)
        {
            string src = "";

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

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

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

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

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

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

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

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

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

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

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

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

                                dtBKKDetail            = new DataTable();
                                dgDetailBKK.DataSource = dtBKKDetail.DefaultView;
                                dgDetailBKK.Focus();
                            }
                            catch (Exception ex)
                            {
                                Error.LogError(ex);
                            }
                        }
                        else if (formMode == enumFormMode.Update)
                        {
                            try
                            {
                                using (Database db = new Database(GlobalVar.DBName))
                                {
                                    db.Commands.Add(db.CreateCommand("usp_Bukti_UPDATE"));
                                    db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowID));
                                    db.Commands[0].Parameters.Add(new Parameter("@Kepada", SqlDbType.VarChar, tbKepada.Text));
                                    db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                                    db.Commands[0].ExecuteNonQuery();
                                }
                                frmBKKBrowse frm = new frmBKKBrowse();
                                frm = (frmBKKBrowse)this.Caller;
                                frm.HeaderRowRefresh(_rowID);
                                dgDetailBKK.Focus();
                            }
                            catch (Exception ex)
                            {
                                Error.LogError(ex);
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Attachment belum ditambahkan !!");
                    return;
                }
            }
        }
Exemplo n.º 11
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            switch (selectedGrid)
            {
            case enumSelectedGrid.DetailSelected:

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

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

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

                        RefreshBBM(rowIDBBM);

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

                        DataRow dr = dv.Row;

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

                break;

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

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

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



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

                            DataRow dr = dv.Row;

                            dr.Delete();
                            _dtHeader.AcceptChanges();
                            gridBBM.Focus();
                            gridBBM.RefreshEdit();
                            if (gridBBM.RowCount > 0)
                            {
                                if (i == 0)
                                {
                                    gridBBM.CurrentCell = gridBBM.Rows[0].Cells[n];
                                    gridBBM.RefreshEdit();
                                }
                                else
                                {
                                    gridBBM.CurrentCell = gridBBM.Rows[i - 1].Cells[n];
                                    gridBBM.RefreshEdit();
                                }
                            }
                            #endregion
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                    }
                }
                break;
            }
        }
Exemplo n.º 12
0
        private void cmdDelete_Click_1(object sender, EventArgs e)
        {
            DateTime _Tanggal = (DateTime)tbTanggal.DateValue;

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

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

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

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

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

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

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

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

                // Bukti detail
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_BuktiDetail_DELETE"));
                        db.Commands[0].Parameters.Add(new Parameter("@headerID", SqlDbType.UniqueIdentifier, _RowID));
                        db.Commands[0].ExecuteNonQuery();
                    }
                    MessageBox.Show("Record telah dihapus");
                    KasbonRefresh();
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }
        }
Exemplo n.º 13
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);
            }
        }
Exemplo n.º 14
0
        private void btnAttachment_Click(object sender, EventArgs e)
        {
            if (dgHeaderBKK.SelectedCells.Count > 0)
            {
                if (dgHeaderBKK.SelectedCells[0].OwningRow.Cells["Src"].Value.ToString() != "OUT")
                {
                    return;
                }

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

                if (dgHeaderBKK.SelectedCells[0].OwningRow.Cells["AttachmentBKK"].Value.ToString() == "1")
                {
                    DialogResult dr = MessageBox.Show("Sudah memiliki Attachment. Akan mengganti Attachment?", "KONFIRMASI", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr == DialogResult.No)
                    {
                        return;
                    }
                }

                OpenFileDialog OFD = new OpenFileDialog();
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    OFD.Filter  = "File Gambar (*.JPEG, *.jpg, *.bmp, *.gif, *.png)|*.JPEG; *.jpg; *.bmp; *.gif; *.png";
                    if (OFD.ShowDialog() == DialogResult.OK)
                    {
                        string strFilename = OFD.SafeFileName;
                        string strPathName = OFD.FileName;

                        System.IO.FileInfo fileSize = new System.IO.FileInfo(strPathName);

                        if (fileSize.Length > 1048576)
                        {
                            MessageBox.Show("Ukuran file terlalu besar. Maksimal 1 MB");
                        }
                        else
                        {
                            string strAttacmentBKK = Base64FromImage(strPathName);
                            Guid   RowID           = (Guid)dgHeaderBKK.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                            string strUser         = SecurityManager.UserID;

                            using (Database db = new Database(GlobalVar.DBName))
                            {
                                db.Commands.Add(db.CreateCommand("usp_Bukti_AttachmentBKK_UPDATE"));
                                db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, RowID));
                                db.Commands[0].Parameters.Add(new Parameter("@AttachmentBKK", SqlDbType.VarChar, strAttacmentBKK));
                                db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, strUser));
                                db.Commands[0].ExecuteNonQuery();
                            }
                            HeaderRefresh();
                            MessageBox.Show("ATTACHMENT FILE BERHASIL", "SUCCESS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString(), "ERROR ATTACHMENT FILE", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                    OFD.Dispose();
                }
            }
        }
Exemplo n.º 15
0
        private void tbKepada_Leave(object sender, EventArgs e)
        {
            string src = "";

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

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


                        _recordID = BKK.GetRecordIDBukti(_recordID, src);

                        _rowID = Guid.NewGuid();

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

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

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

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

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

                            dtBKKDetail            = new DataTable();
                            dgDetailBKK.DataSource = dtBKKDetail.DefaultView;
                            dgDetailBKK.Focus();
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                    }
                    else if (formMode == enumFormMode.Update)
                    {
                        try
                        {
                            using (Database db = new Database(GlobalVar.DBFinance))
                            {
                                db.Commands.Add(db.CreateCommand("usp_Bukti_UPDATE"));
                                db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowID));
                                db.Commands[0].Parameters.Add(new Parameter("@Kepada", SqlDbType.VarChar, lookupStafAdm1.Kode));
                                db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                                db.Commands[0].ExecuteNonQuery();
                            }
                            frmBKKBrowse frm = new frmBKKBrowse();
                            frm = (frmBKKBrowse)this.Caller;
                            frm.HeaderRowRefresh(_rowID);
                            dgDetailBKK.Focus();
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                    }
                    cmdAdd.PerformClick();
                }
            }
        }
Exemplo n.º 16
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            if (PeriodeClosing.IsPJTClosed(dateTMT.DateValue.Value))
            {
                MessageBox.Show("Periode Tanggal Sudah Closing");
                return;
            }

            try
            {
                string cGudang = GlobalVar.Gudang;
                switch (formMode)

                {
                case enumFormMode.New:

                    using (Database db = new Database())
                    {
                        _rowID = Guid.NewGuid();
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_HistoryTargetSales_INSERT"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@SalesID", SqlDbType.VarChar, lookupSales1.SalesID));
                        db.Commands[0].Parameters.Add(new Parameter("@TglAktif", SqlDbType.Date, dateTMT.DateValue.Value));
                        db.Commands[0].Parameters.Add(new Parameter("@SKU", SqlDbType.Int, txtSkuR2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@OmsetNetto", SqlDbType.Int, txtOmsetNetto.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@OrderAktif", SqlDbType.Int, txtOrdAktif.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SyncFlag", SqlDbType.VarChar, 0));
                        db.Commands[0].Parameters.Add(new Parameter("@lastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        dt = db.Commands[0].ExecuteDataTable();
                    }
                    break;

                case enumFormMode.Update:
                    using (Database db = new Database())
                    {
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_HistoryTargetSales_UPDATE"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@SalesID", SqlDbType.VarChar, lookupSales1.SalesID));
                        db.Commands[0].Parameters.Add(new Parameter("@TglAktif", SqlDbType.Date, dateTMT.DateValue.Value));
                        db.Commands[0].Parameters.Add(new Parameter("@SKU", SqlDbType.Int, txtSkuR2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@OmsetNetto", SqlDbType.Int, txtOmsetNetto.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@OrderAktif", SqlDbType.Int, txtOrdAktif.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SyncFlag", SqlDbType.VarChar, 0));
                        db.Commands[0].Parameters.Add(new Parameter("@lastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        db.Commands[0].ExecuteNonQuery();
                    }
                    break;
                }
                frmTargetSales frm = new frmTargetSales();
                frm = (frmTargetSales)Caller;
                frm.BindData();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
Exemplo n.º 17
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            if (lookupNotaPiutang1.KPID == Guid.Empty)
            {
                MessageBox.Show("No Nota Belum Diisi");
                lookupNotaPiutang1.Focus();
                return;
            }
            if (tbRpTagih.GetDoubleValue < tbRpInden.GetDoubleValue)
            {
                MessageBox.Show("Jumlah Rp Inden Tidak Boleh Melebihi Tagihan(" + tbRpTagih.Text + ")");
                tbRpInden.Focus();
                return;
            }
            if (tbRpInden.GetDoubleValue > Convert.ToDouble(RpInden))
            {
                MessageBox.Show("Jumlah Rp Inden Tidak Boleh Melebihi Nilai Identifikasi (" + Convert.ToDouble(RpInden).ToString("#,###") + ")");
                tbRpInden.Focus();
                return;
            }

            if (tbRpInden.GetDoubleValue == 0)
            {
                MessageBox.Show("Jumlah Rp Inden Tidak Boleh 0");
                tbRpInden.Focus();
                return;
            }

            DateTime _Tanggal = (DateTime)tbTglInden.DateValue;

            if (PeriodeClosing.IsPJTClosed(_Tanggal))
            {
                MessageBox.Show("Sudah Closing!");
                return;
            }
            using (Database db = new Database())
            {
                db.Commands.Add(db.CreateCommand("usp_GetTokoIDWil"));
                db.Commands[0].Parameters.Add(new Parameter("@kodetoko", SqlDbType.VarChar, kodeToko));
                dtIDWil = db.Commands[0].ExecuteDataTable();
            }

            //string kodeTrn = "COL" + dtIDWil.Rows[0]["WilID"].ToString().Substring(0, 1);
            string kodeTrn      = "PJT";
            string dNoPerkiraan = Perkiraan.GetPerkiraanKoneksiDetail(kodeTrn).Rows[0]["NoPerkiraan"].ToString();

            RowIDISSD = Guid.NewGuid();
            RecordID  = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);
            try
            {
                using (Database db = new Database(GlobalVar.DBFinance))
                {
                    db.BeginTransaction();
                    //insert indensuperdetail

                    addIndenSuperDetail(db, RowIDISSD, RowIDISD, RowIDI, RowIDID, RecordID
                                        , HRecordID, lookupNotaPiutang1.TagihDetailID
                                        , lookupNotaPiutang1.TagihDetailRecID, lookupNotaPiutang1.KPID
                                        , lookupNotaPiutang1.KPrecID, lookupNotaPiutang1.Jenis, tglBPP, noReg
                                        , chbg, noBukti, (DateTime)tbTglInden.DateValue
                                        , (DateTime)tbTglJTempo.DateValue, "", "", dNoPerkiraan
                                        , tbRpInden.Text, tbRpNota.Text, tbRpTagih.Text);

                    if (lookupNotaPiutang1.Jenis == "KP")
                    {
                        insertKPiutangDetail(db);
                    }
                    else
                    {
                        insertGtolakDetail(db);
                    }

                    //if (GlobalVar.Gudang != "2803")
                    //{
                    //    updateTagihanDetail(db);
                    //    insertTagihanSubDetail(db);
                    //}
                    db.CommitTransaction();
                }

                //tutup sementara
                frmPenerimaanBelumTeridentifikasiBrowse frm = new frmPenerimaanBelumTeridentifikasiBrowse();
                frm = (frmPenerimaanBelumTeridentifikasiBrowse)Caller;
                frm.IndenRowRefresh(RowIDI);
                frm.IndenDetailRowRefresh(RowIDID);
                frm.IndenSubDetailRowRefresh(RowIDISD);
                frm.IndenSuperDetailRowRefresh(RowIDISSD);
                frm.IndenSuperDetailFindRow("RowIDISSD", RowIDISSD.ToString());
                this.Close();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
Exemplo n.º 18
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            string val_ = Tools.isNull(cboTrans.SelectedValue, "").ToString();

            if (val_ == "" || _HeaderID == Guid.Empty)
            {
                return;
            }

            if (val_.Equals("ADJ") && txtUraian.Text.Trim().Equals(string.Empty))
            {
                errorProvider1.SetError(txtUraian, "Kolom Uraian Harus di isi untuk Transaski ADJ");
                txtUraian.Focus();
                return;
            }

            if (txtKredit.GetDoubleValue == 0)
            {
                errorProvider1.SetError(txtKredit, "Kredit Tidak Boleh kosong");
                return;
            }
            if (PeriodeClosing.IsPJTClosed(tglTrans.DateValue.Value))
            {
                errorProvider1.SetError(tglTrans, "Tgl Berada dalam periode closing, Link akan di lakukan pada bulan berikutnya");
                tglTrans.DateValue = PeriodeClosing.LastClosingPJT.AddDays(+1);
                tglTrans.SelectAll();
                return;
            }

            switch (val_)
            {
            case "RET":
            {
                SetGTDLink();
            }
            break;

            case "KPJ":
            {
                SetGTDLink();
            }
            break;

            case "KRJ":
            {
                SetGTDLink();
            }
            break;

            case "MUT":
            {
                switch (_Keterangan)
                {
                case "GiroTolak":
                    SetMutasi();
                    break;

                case "KartuPiutang":
                    SetCrossMutasi();
                    break;
                }
            }
            break;

            case "PLL":
            {
                SetGTD();
            }
            break;

            case "POT":
            {
                SetGTD();
            }
            break;

            case "ADJ":
            {
                SetGTD();
            }
            break;
            }


            this.Close();
        }