예제 #1
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            #region lama
            //try
            //{
            //    TglKasir = (DateTime)tbTanggal.DateValue;
            //    this.Cursor = Cursors.WaitCursor;
            //    using (Database db = new Database(GlobalVar.DBName))
            //    {
            //        db.Commands.Add(db.CreateCommand("fsp_IsClosingKasir"));
            //        db.Commands[0].Parameters.Add(new Parameter("@checkDate", SqlDbType.DateTime, TglKasir));
            //        object cek = db.Commands[0].ExecuteScalar();
            //        if (cek.ToString() == "True")
            //        {
            //            MessageBox.Show("Sudau Closing Kasir.");
            //            tbTanggal.Focus();
            //            return;
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    Error.LogError(ex);
            //}
            //finally
            //{
            //    this.Cursor = Cursors.Default;
            //}
            #endregion

            try
            {
                if (tbTanggal.DateValue.ToString() != "" && tbCollector.Text != "")
                {
                    TglKasir      = (DateTime)tbTanggal.DateValue;
                    Acc           = tbMengetahui.Text;
                    NamaCollector = tbCollector.Text;
                    if (formMode == enumFormMode.New)
                    {
                        if (PeriodeClosing.IsKasirClosed(TglKasir))
                        {
                            MessageBox.Show("Sudah Closing!");
                            return;
                        }
                        noBukti = Numerator.BookNumerator("IND");
                        //if (_isFromPiutang)
                        //    RowIDI = _rowIDPK;
                        //else
                        //    RowIDI = Guid.NewGuid();

                        string RecordIDI;
                        RowIDI = Guid.NewGuid();
                        if (_isFromPiutang)
                        {
                            RecordIDI = _recID;
                        }
                        else
                        {
                            RecordIDI = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);
                        }

                        using (Database db = new Database(GlobalVar.DBName))
                        {
                            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();
                        }

                        if (_isFromPiutang == true)
                        {
                            frmIndenDetailUpdate frm = new frmIndenDetailUpdate(this, RowIDI, RecordIDI, NamaCollector, TglKasir, noBukti, CollectorID, true, _rpsisa, _rowIDPK, _nip);
                            frm.ShowDialog();

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


                    else
                    {
                        using (Database db = new Database(GlobalVar.DBName))
                        {
                            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);
            }
        }
예제 #2
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);
            }
        }