Example #1
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            if (PeriodeClosing.IsPJTClosed(dTxtTMT.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_HistoryTargetCollector_INSERT"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@CollID", SqlDbType.VarChar, txtKdColl.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@TglAktif", SqlDbType.Date, dTxtTMT.DateValue.Value));
                        db.Commands[0].Parameters.Add(new Parameter("@Tagih", SqlDbType.Int, nTxtTagih.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@Kunjungan", SqlDbType.Int, nTxtKunj.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@Nominal", SqlDbType.Int, nTxtNominal.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_HistoryTargetCollector_UPDATE"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@CollID", SqlDbType.VarChar, txtKdColl.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@TglAktif", SqlDbType.Date, dTxtTMT.DateValue.Value));
                        db.Commands[0].Parameters.Add(new Parameter("@Tagih", SqlDbType.Int, nTxtTagih.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@Kunjungan", SqlDbType.Int, nTxtKunj.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@Nominal", SqlDbType.Int, nTxtNominal.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;
                }
                frmTargetCollector frm = new frmTargetCollector();
                frm = (frmTargetCollector)Caller;
                frm.BindData();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
Example #2
0
        private bool ValidateInput()
        {
            bool valid = true;

            errorProvider1.Clear();

            if (txtNoKoreksi.Text == "")
            {
                errorProvider1.SetError(txtNoKoreksi, "Nomor Koreksi tidak boleh kosong");
                valid = false;
            }

            if (txtTglKoreksi.Text == "")
            {
                errorProvider1.SetError(txtTglKoreksi, "Tgl Koreksi tidak boleh kosong");
                valid = false;
            }
            else
            {
                if (PeriodeClosing.IsPJTClosed(txtTglKoreksi.DateValue.Value))
                {
                    errorProvider1.SetError(txtTglKoreksi, "Sudah Closing");
                    valid = false;
                }
            }

            if (txtQtyNota1.Text == txtQtyNota2.Text && formMode != enumFormMode.Update)
            {
                errorProvider1.SetError(txtQtyNota2, "Tidak ada koreksi");
                valid = false;
            }
            return(valid);
        }
Example #3
0
        private void frmRegisterUpdate_Load(object sender, EventArgs e)
        {
            foreach (Control ctr in groupBox1.Controls)
            {
                if (ctr is CheckBox)
                {
                    CheckBox chk = (CheckBox)ctr;
                    chk.Click += new EventHandler(UncheckALL);
                }
            }
            if (PeriodeClosing.IsPJTClosed(DateTime.Now))
            {
                dateTextBox1.DateValue = PeriodeClosing.LastClosingPJT.AddDays(1);
            }
            else
            {
                dateTextBox1.DateValue = DateTime.Now;
            }
            checkBox1.Checked       = true;
            CheckBoxUmur.Checked    = true;
            numericTextBox1.Enabled = false;
            lookupSales1.Enabled    = false;
            // string docNoDO = "NOMOR_REGISTER";

            DataTable dtNum = Tools.GetGeneralNumerator("REG", GlobalVar.DBFinance);

            int lebar = 4;
            int iNomor;

            try
            {
                iNomor = int.Parse(dtNum.Rows[0]["Nomor"].ToString());
            }
            catch
            {
                iNomor = 0;
            }
            string depan = Tools.Right(DateTime.Now.Year.ToString(), 1) + Tools.Right("0" + DateTime.Now.Month.ToString(), 2);
            string belakang;

            try
            {
                belakang = dtNum.Rows[0]["Belakang"].ToString();
            }
            catch
            {
                belakang = "";
            }
            iNomor++;

            txtRegister.Text       = Tools.FormatNumerator(iNomor, lebar, depan, "");
            rangeDateBox1.FromDate = DateTime.Now.AddDays(-7);
            rangeDateBox1.ToDate   = DateTime.Now;
            GetCollector();
        }
Example #4
0
        private bool ValidateInput()
        {
            bool valid = true;

            errorProvider1.Clear();

            //if (txtNoKoreksi.Text == "")
            //{
            //    errorProvider1.SetError(txtNoKoreksi, "Nomor Koreksi tidak boleh kosong");
            //    valid = false;
            //}

            if (txtTglKoreksi.Text == "")
            {
                errorProvider1.SetError(txtTglKoreksi, "Tgl Koreksi tidak boleh kosong");
                valid = false;
            }
            else
            {
                if (PeriodeClosing.IsPJTClosed(txtTglKoreksi.DateValue.Value))
                {
                    errorProvider1.SetError(txtTglKoreksi, "Sudah Closing");
                    valid = false;
                }
            }

            if (txtQtyNota1.Text == txtQtyNota2.Text && formMode != enumFormMode.Update)
            {
                errorProvider1.SetError(txtQtyNota2, "Tidak ada koreksi");
                valid = false;
            }
            if (txtTglKoreksi.DateValue != GlobalVar.DateOfServer)
            {
                errorProvider1.SetError(txtQtyNota2, "Tanggal Koreksi Tidak Sama Dengan Date of server");
                valid = false;
            }
            return(valid);
        }
Example #5
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            string val_ = Tools.isNull(cboTrans.SelectedValue, "").ToString();

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

            if (val_.Equals("ADJ"))
            {
                txtNoACC.ReadOnly = false;
                txtNoACC.TabStop  = true;
                if (txtNoACC.Text.Trim().Equals(string.Empty))
                {
                    errorProvider1.SetError(txtNoACC, "Belum ada No Acc, Proses ADJ dibatalkan.");
                    txtNoACC.Focus();
                    return;
                }
                if (txtUraian.Text.Trim().Equals(string.Empty))
                {
                    errorProvider1.SetError(txtUraian, "Kolom Uraian Harus di isi untuk Transaski ADJ");
                    txtUraian.Focus();
                    return;
                }
            }
            else
            {
                txtNoACC.ReadOnly = true;
                txtNoACC.TabStop  = false;
            }

            if (GlobalVar.Gudang != "2808")
            {
                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;
                }
            }

            if (txtKredit.GetDoubleValue == 0 && txtDebet.GetDoubleValue == 0)
            {
                errorProvider1.SetError(txtDebet, "Debet & Kredit Tidak Boleh kosong");
                errorProvider1.SetError(txtKredit, "Debet & Kredit Tidak Boleh kosong");
                return;
            }

            if (txtKredit.GetDoubleValue < 0)
            {
                txtKredit.Text = (txtKredit.GetDoubleValue * -1).ToString();
            }

            if (txtDebet.GetDoubleValue < 0)
            {
                txtDebet.Text = (txtDebet.GetDoubleValue * -1).ToString();
            }

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

            case "KPJ":
            {
                SetData();
                RefreshData();
            }
            break;

            case "KRJ":
            {
                SetData();
                RefreshData();
            }
            break;

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

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

            case "PLL":
            {
                SetDataAdj();
                RefreshData();
            }
            break;

            case "POT":
            {
                SetDataAdj();
                RefreshData();
            }
            break;

            case "ADJ":
            {
                SetDataAdj();
                RefreshData();
            }
            break;

            case "DIL":
            {
                SetData();
                RefreshData();
            }
            break;
            }


            this.Close();
        }
Example #6
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            DateTime tmt = new DateTime();

            if (cboKodeKasus.SelectedValue.ToString().Equals(string.Empty))
            {
                cboKodeKasus.Focus();
                errorProvider1.SetError(cboKodeKasus, "Tidak Boleh Kosong");
                return;
            }

            if (textBox1.Text.Trim() == "")
            {
                textBox1.Focus();
                errorProvider1.SetError(textBox1, "Tidak Boleh Kosong");
                return;
            }


            if (dateTextBox1.DateValue.HasValue == false)
            {
                dateTextBox1.Focus();
                errorProvider1.SetError(dateTextBox1, "Tidak Boleh Kosong");
                return;
            }

            if (PeriodeClosing.IsPJTClosed((DateTime)dateTextBox1.DateValue) == true)
            {
                tmt = PeriodeClosing.LastClosingPJT.AddDays(1);
            }
            else
            {
                tmt = (DateTime)dateTextBox1.DateValue;
            }

            switch (formMode)
            {
            case enumFormMode.New:
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        db.Commands.Add(db.CreateCommand("[usp_TokoKasus_INSERT]"));
                        _RowID = Guid.NewGuid();
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _RowID));
                        db.Commands[0].Parameters.Add(new Parameter("@TglMT", SqlDbType.Date, tmt));
                        db.Commands[0].Parameters.Add(new Parameter("@KodeKasus", SqlDbType.VarChar, cboKodeKasus.SelectedValue.ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@Keterangan", SqlDbType.VarChar, textBox1.Text.Trim()));
                        db.Commands[0].Parameters.Add(new Parameter("@KodeToko", SqlDbType.VarChar, _KodeToko));
                        db.Commands[0].Parameters.Add(new Parameter("@RecordID", SqlDbType.VarChar, Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserID)));
                        db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserName));
                        db.Commands[0].ExecuteNonQuery();
                    }
                }
                catch (SqlException ex)
                {
                    Error.LogError(ex);
                }
                catch (System.Exception ex)
                {
                    Error.LogError(ex);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                    RefreshData();
                }
                break;

            case enumFormMode.Update:
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        db.Commands.Add(db.CreateCommand("usp_TokoKasus_Update"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _RowID));
                        db.Commands[0].Parameters.Add(new Parameter("@TglMT", SqlDbType.Date, dateTextBox1.DateValue));
                        db.Commands[0].Parameters.Add(new Parameter("@KodeKasus", SqlDbType.VarChar, cboKodeKasus.SelectedValue.ToString()));
                        db.Commands[0].Parameters.Add(new Parameter("@Keterangan", SqlDbType.VarChar, textBox1.Text.Trim()));
                        db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserName));
                        db.Commands[0].ExecuteNonQuery();
                    }
                }
                catch (System.Exception ex)
                {
                    Error.LogError(ex);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                    RefreshData();
                }
                break;
            }
            this.Close();
        }
Example #7
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);
            }
        }
Example #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_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);
            }
        }
Example #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);
            }
        }
Example #10
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);
            }
        }
Example #11
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();
        }