Exemplo n.º 1
0
        private void InsertDataHeader()
        {
            frmDebetKreditNotaBrowse frmCaller = (frmDebetKreditNotaBrowse)this.Caller;

            if (Modus == enumModus.New)
            {
                _HeaderID = Guid.NewGuid();
                _RecID    = Tools.CreateShortFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial, 1);
            }
            DateTime TglBukti = Convert.ToDateTime(dateDKN.DateValue);
            string   Cabang   = txtGudang.Text;
            string   DK       = "";

            if (optDebet.Checked)
            {
                DK = "D";
            }
            else
            {
                DK = "K";
            }

            using (Database db = new Database(GlobalVar.DBName))
            {
                //if (Modus == enumModus.Update) RowIDDKN = _HeaderID;
                DKN.DKNInsert(db, _HeaderID, _RecID, DK, "MAN", "B", "DKN", TglBukti, Cabang, "", _HeaderID);
            }
            frmCaller.RefreshDkn();
        }
Exemplo n.º 2
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (CabangDKN.Text == "")
            {
                MessageBox.Show("Cabang belum diisi.");
                CabangDKN.Focus();
                return;
            }

            if (tbRpIdentifikasi.GetDoubleValue == 0)
            {
                MessageBox.Show("Rp Identifikasi Tidak Boleh 0.");
                tbRpIdentifikasi.Focus();
                return;
            }

            if (tbRpIdentifikasi.GetDoubleValue > jumlah)
            {
                MessageBox.Show("Rp Identifikasi Tidak Boleh lebih dari " + jumlah.ToString("#,###"));
                tbRpIdentifikasi.Focus();
                return;
            }

            cabang = CabangDKN.Text;
            double rpIdentifikasi = tbRpIdentifikasi.GetDoubleValue;

            DataTable dtCek = new DataTable();

            dtCek = DKN.CekLinkDKN(refRowIDHeader, cabang);


            Guid   _rowID    = new Guid();
            String _recordID = "";

            using (Database db = new Database(GlobalVar.DBFinance))
            {
                db.BeginTransaction();
                if (dtCek.Rows.Count == 0)
                {
                    _rowID    = Guid.NewGuid();
                    _recordID = refRecordIDHeader.Trim() + cabang.Substring(0, 2);
                    DKN.DKNInsert(db, _rowID, _recordID, DK, refTipe, CD, src, DateTime.Today, cabang, refNoBukti, refRowIDHeader);
                }
                else
                {
                    DataTable dtCekDet = new DataTable();
                    dtCekDet = dtCek.Copy();
                    dtCekDet.DefaultView.RowFilter = "RefRowID='" + refRowIDDetail.ToString() + "'";
                    if (dtCekDet.DefaultView.Count > 0)
                    {
                        MessageBox.Show("Sudah Pernah Link ke Cabang " + cabang + ".");
                        return;
                    }
                    _rowID    = (Guid)dtCek.Rows[0][0];
                    _recordID = dtCek.Rows[0][1].ToString();
                }
                DKN.DKNDetailInsert(db, _rowID, _recordID, noPerkiraan, uraian, rpIdentifikasi, refRowIDDetail, refRecordIDDetail.Trim() + cabang.Substring(0, 2));

                DKN.UpdateKodeLink(db, refRowIDDetail, "#", namaSP, "");
                db.CommitTransaction();
            }
            this.Close();
        }
Exemplo n.º 3
0
        private void cmdSAVE_Click(object sender, EventArgs e)
        {
            _BankTujuanRowID = lookupBankTujuan.RowID;
            _BankIDtujuan    = lookupBankTujuan.BankID;
            string _KodeToko = lookupToko1.KodeToko;
            string lokasi    = lookupBankAsal1.Lokasi;
            string bankID    = lookupBankTujuan.BankID;

            try
            {
                this.Cursor = Cursors.WaitCursor;
                using (Database db = new Database(GlobalVar.DBName))
                {
                    DataTable dtBK = new DataTable();
                    db.Commands.Add(db.CreateCommand("usp_BankKota_LIST"));
                    db.Commands[0].Parameters.Add(new Parameter("@NamaBank", SqlDbType.VarChar, lookupBankAsal1.NamaBank));
                    db.Commands[0].Parameters.Add(new Parameter("@Lokasi", SqlDbType.VarChar, lookupBankAsal1.Lokasi));
                    dtBK = db.Commands[0].ExecuteDataTable();
                    if (dtBK.Rows.Count > 0)
                    {
                        _BankKotaRowID = new Guid(dtBK.Rows[0]["RowID"].ToString());
                    }
                }
            }
            catch (System.Exception ex)
            {
                Error.LogError(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }

            frmDebetKreditNotaBrowse frmCaller = (frmDebetKreditNotaBrowse)this.Caller;

            if (Brow == enumBrow.Header)
            {
                Guid     RowID    = Guid.NewGuid();
                string   RecordID = Tools.CreateShortFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial, 1);
                DateTime TglBukti = Convert.ToDateTime(dateDKN.DateValue);
                string   Cabang   = cboCabang.SelectedValue.ToString();
                string   DK       = "";
                if (optDebet.Checked)
                {
                    DK = "D";
                }
                else
                {
                    DK = "K";
                }

                using (Database db = new Database(GlobalVar.DBName))
                {
                    if (Modus == enumModus.Update)
                    {
                        RowID = _HeaderID;
                    }
                    DKN.DKNInsert(db, RowID, RecordID, DK, "MAN", "B", "DKN", TglBukti, Cabang, "", RowID);
                }
                frmCaller.RefreshDkn();
            }
            else
            {
                if (_IsiPin == "")
                {
                    string NoPerkiraan  = txtPerkiraan.NoPerkiraan;
                    string Uraian       = txtUraian.Text;
                    string HRecordID    = frmCaller.gridUtm.SelectedCells[0].OwningRow.Cells["RecordID"].Value.ToString();
                    string refRecordID  = Tools.CreateShortFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial, 1);
                    Guid   refRowID     = Guid.NewGuid();
                    Double Jumlah       = Convert.ToDouble(numJumlah.Text);
                    string KodeKolektor = txtCollectorID.Text;
                    string Kolektor     = txtCollector.Text;
                    Guid   rowIDdetail;

                    if (Modus == enumModus.New)
                    {
                        rowIDdetail = Guid.NewGuid();
                    }
                    else
                    {
                        rowIDdetail = _DetailID;
                    }

                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        if (Modus == enumModus.Update)
                        {
                            refRowID = _DetailID;
                        }
                        DKN.DKNDetailInsert(db, rowIDdetail, _HeaderID, HRecordID, NoPerkiraan, Uraian, Jumlah, refRowID, refRecordID, KodeKolektor, bankID, _BankTujuanRowID, _BankKotaRowID, _KodeToko);
                    }
                    frmCaller.RefreshDknDetail();
                }
                else
                {
                    UpdateDKN();
                }
            }
            this.Close();
        }