Example #1
0
        private void titipGiro()
        {
            try
            {
                Guid _GiroID = (Guid)gridDetail.SelectedCells[0].OwningRow.Cells["GiroID"].Value;
                using (Database db = new Database(GlobalVar.DBFinance))
                {
                    db.Commands.Add(db.CreateCommand("usp_Giro_UPDATE"));
                    db.Commands[0].Parameters.Add(new Parameter("@GiroID", SqlDbType.UniqueIdentifier, _GiroID));
                    db.Commands[0].Parameters.Add(new Parameter("@TitipID", SqlDbType.UniqueIdentifier, _titipID));
                    db.Commands[0].Parameters.Add(new Parameter("@TitipRecID", SqlDbType.VarChar, _titipRecID));
                    db.Commands[0].Parameters.Add(new Parameter("@TglTitip", SqlDbType.DateTime, DateTime.Today));
                    db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));

                    if (jnsSlip == "" || jnsSlip == "Titip")
                    {
                        db.Commands[0].Parameters.Add(new Parameter("@BankID", SqlDbType.VarChar, _bankID));
                        db.Commands[0].Parameters.Add(new Parameter("@NamaBanki", SqlDbType.VarChar, _namaBank));
                    }
                    else if (jnsSlip == "Tunai")
                    {
                        db.Commands[0].Parameters.Add(new Parameter("@CHBG", SqlDbType.VarChar, "K"));
                        db.Commands[0].Parameters.Add(new Parameter("@CairTolak", SqlDbType.VarChar, "C"));
                        db.Commands[0].Parameters.Add(new Parameter("@TglCair", SqlDbType.VarChar, DateTime.Today));
                    }
                    db.Commands[0].ExecuteNonQuery();
                }

                if (jnsSlip == "Tunai")
                {
                    cetakLaporan();
                }

                frmVoucherGiroTitipanBrowse frm = new frmVoucherGiroTitipanBrowse();
                frm = (frmVoucherGiroTitipanBrowse)Caller;
                frm.HeaderRowRefresh(_titipID);
                frm.DetailRowRefresh(_GiroID);
                frm.DetailFindRow("GiroID", _GiroID.ToString());
                this.Close();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
Example #2
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.DBFinance))
                    {
                        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.DBFinance))
                    {
                        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);
            }
        }