예제 #1
0
        private void cmdPrint_Click(object sender, EventArgs e)
        {
            if (selectedGrid == enumSelectedGrid.DetailSelected)
            {
                Guid      _RowID = (Guid)gridPiutang.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                string    _reff  = gridPiutang.SelectedCells[0].OwningRow.Cells["Reff"].Value.ToString();
                string    MK     = "";
                DataTable dt     = new DataTable();
                try
                {
                    using (Database db = new Database(GlobalVar.DBFinance))
                    {
                        db.Commands.Add(db.CreateCommand("rsp_CetakPiutangKaryawan"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _RowID));
                        db.Commands[0].Parameters.Add(new Parameter("@Ref", SqlDbType.VarChar, _reff));
                        dt = db.Commands[0].ExecuteDataTable();
                    }

                    if (_reff == "BKK" || _reff == "BKM")
                    {
                        if (_reff == "BKK")
                        {
                            MK = "K";
                        }
                        else
                        {
                            MK = "M";
                        }
                        if ((int)dt.Rows[0]["NPrint"] > 0 && (!SecurityManager.IsManager() && SecurityManager.AskPasswordManager() == false))
                        {
                            return;
                        }

                        BKM.cetakBukti(dt, MK);
                    }
                    else if (_reff == "TRK" || _reff == "TRM" || _reff == "TRN")
                    {
                        if (_reff == "TRK")
                        {
                            MK = "K";
                        }
                        else
                        {
                            MK = "M";
                        }
                        if ((int)dt.Rows[0]["NPrint"] > 0 && (!SecurityManager.IsManager() && SecurityManager.AskPasswordManager() == false))
                        {
                            return;
                        }

                        TransferBank.cetakTransfer(dt, MK);
                    }
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
            }
        }