コード例 #1
0
 private void cmdClose_Click(object sender, EventArgs e)
 {
     if (this.Caller is Kasir.frmPenerimaanLeasingBrowse)
     {
         Kasir.frmPenerimaanLeasingBrowse frmCaller = (Kasir.frmPenerimaanLeasingBrowse) this.Caller;
         frmCaller.RefreshHeader(PenerimaanUangRowID);
         frmCaller.RefreshDetail(Guid.Empty);
     }
     this.Close();
 }
コード例 #2
0
        private void cmdSAVE_Click(object sender, EventArgs e)
        {
            if (Double.Parse(txtNominal.Text) == 0)
            {
                MessageBox.Show("Nominal harus >=0");
                txtNominal.Focus();
                return;
            }

            if (Double.Parse(txtNominal.Text) > Double.Parse(txtNominalSisa.Text))
            {
                MessageBox.Show("Sisa Nominal hanya " + txtNominalSisa.Text);
                txtNominal.Focus();
                return;
            }

            if (txtUraian.Text == "")
            {
                MessageBox.Show("Uraian harus di isi.");
                txtUraian.Focus();
                return;
            }

            try
            {
                Database dbfNumerator      = new Database(GlobalVar.DBFinanceOto);
                String   NoTransPenerimaan = Numerator.GetNomorDokumen(dbfNumerator, "PENERIMAAN_UANG", GlobalVar.PerusahaanID,
                                                                       "/BKM/" +
                                                                       string.Format("{0:yyMM}", GlobalVar.GetServerDate)
                                                                       , 4, false, true);
                Guid _rowID = Guid.NewGuid();
                this.Cursor = Cursors.WaitCursor;
                using (Database db = new Database(GlobalVar.DBShowroom))
                {
                    db.Commands.Add(db.CreateCommand("[usp_PenerimaanUM_INSERT]"));
                    db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                    db.Commands[0].Parameters.Add(new Parameter("@PenjRowID", SqlDbType.UniqueIdentifier, _rowidP));
                    db.Commands[0].Parameters.Add(new Parameter("@CabangID", SqlDbType.VarChar, GlobalVar.CabangID));
                    db.Commands[0].Parameters.Add(new Parameter("@NoTrans", SqlDbType.VarChar, NoTransPenerimaan));
                    db.Commands[0].Parameters.Add(new Parameter("@Uraian", SqlDbType.VarChar, txtUraian.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@KodeTrans", SqlDbType.VarChar, "ADJ"));
                    db.Commands[0].Parameters.Add(new Parameter("@Tanggal", SqlDbType.DateTime, txtTglAdj.DateValue));
                    db.Commands[0].Parameters.Add(new Parameter("@MataUangID", SqlDbType.VarChar, "IDR"));
                    db.Commands[0].Parameters.Add(new Parameter("@Nominal", SqlDbType.Money, Double.Parse(txtNominal.Text)));
                    db.Commands[0].Parameters.Add(new Parameter("@NilaiBG", SqlDbType.Money, 0));
                    db.Commands[0].Parameters.Add(new Parameter("@idrec", SqlDbType.VarChar, Tools.CreateFingerPrintMilliseconds()));
                    db.Commands[0].Parameters.Add(new Parameter("@BentukPembayaran", SqlDbType.SmallInt, 1));
                    db.Commands[0].Parameters.Add(new Parameter("@CreatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                    db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                    db.Commands[0].ExecuteNonQuery();
                }

                if (this.Caller is Kasir.frmPenerimaanLeasingBrowse)
                {
                    Kasir.frmPenerimaanLeasingBrowse frmCaller = (Kasir.frmPenerimaanLeasingBrowse) this.Caller;
                    frmCaller.RefreshHeader3(_rowidP.ToString());
                    frmCaller.RefreshDetail(Guid.Empty);
                }
                this.Close();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }