private void DownloadJournalDetail() { string fileName = _tempPath + "JournalTmp.DBF"; DataTable result = ValidateFile(fileName, dtJournalDetail); bool YesISA = CekISA(result); if (result != null) { using (Database db = new Database(GlobalVar.DBHoldingName)) { db.Commands.Add(db.CreateCommand("psp_GL_DownloadJournalDetail")); progressBar1.Minimum = 0; progressBar1.Maximum = result.Rows.Count; progressBar1.Value = 0; int nProgress = 0; string NoPerk; foreach (DataRow dr in result.Rows) { NoPerk = Tools.isNull(dr["no_perk"], "").ToString(); if (NoPerk != "" && NoPerk.Trim().Length == 9) { NoPerk = NoPerk.Substring(0, 4) + "." + NoPerk.Substring(4, 2) + "." + NoPerk.Substring(6, 3); } db.Commands[0].Parameters.Clear(); if (YesISA == true) { db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, new Guid(dr["rowid"].ToString()))); } if (YesISA == true) { db.Commands[0].Parameters.Add(new Parameter("@HeaderID", SqlDbType.UniqueIdentifier, new Guid(dr["headerid"].ToString()))); } db.Commands[0].Parameters.Add(new Parameter("@RecordID", SqlDbType.VarChar, Tools.isNull(dr["idrec"], "").ToString().Trim())); db.Commands[0].Parameters.Add(new Parameter("@HrecordID", SqlDbType.VarChar, Tools.isNull(dr["idtrans"], "").ToString().Trim())); db.Commands[0].Parameters.Add(new Parameter("@NoPerkiraan", SqlDbType.VarChar, NoPerk)); db.Commands[0].Parameters.Add(new Parameter("@Uraian", SqlDbType.VarChar, Tools.isNull(dr["uraian"], "").ToString().Trim())); db.Commands[0].Parameters.Add(new Parameter("@Debet", SqlDbType.Money, Tools.isNull(dr["Debet"], "0"))); db.Commands[0].Parameters.Add(new Parameter("@Kredit", SqlDbType.Money, Tools.isNull(dr["Kredit"], "0"))); db.Commands[0].Parameters.Add(new Parameter("@DK", SqlDbType.VarChar, Tools.isNull(dr["dk"], "D").ToString().Trim())); db.Commands[0].Parameters.Add(new Parameter("@KodeGudang", SqlDbType.VarChar, Tools.isNull(GlobalVar.Gudang, "").ToString().Trim())); db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID)); db.Commands[0].ExecuteNonQuery(); progressBar1.Increment(1); nProgress = nProgress + 1; labelProgress.Text = progressBar1.Value.ToString().Trim() + "/" + progressBar1.Maximum.ToString().Trim(); labelProgress.Refresh(); } } } }
private void DownloadClosingGL() { string fileName = _tempPath + "TutupTmp.DBF"; DataTable result = ValidateFile(fileName, dtClosingGL); if (result != null) { using (Database db = new Database(GlobalVar.DBHoldingName)) { db.Commands.Add(db.CreateCommand("psp_GL_DownloadClosingGL")); progressBar1.Minimum = 0; progressBar1.Maximum = result.Rows.Count; progressBar1.Value = 0; int nProgress = 0; string NoPerk; foreach (DataRow dr in result.Rows) { NoPerk = Tools.isNull(dr["kode"], "").ToString(); if (NoPerk != "" && NoPerk.Trim().Length == 9) { NoPerk = NoPerk.Substring(0, 4) + "." + NoPerk.Substring(4, 2) + "." + NoPerk.Substring(6, 3); } db.Commands[0].Parameters.Clear(); db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, Guid.NewGuid())); db.Commands[0].Parameters.Add(new Parameter("@Periode", SqlDbType.VarChar, Tools.isNull(dr["periode"], "").ToString().Trim())); db.Commands[0].Parameters.Add(new Parameter("@KodeGudang", SqlDbType.VarChar, Tools.isNull(dr["idcompany"], "").ToString().Trim())); db.Commands[0].Parameters.Add(new Parameter("@NoPerkiraan", SqlDbType.VarChar, NoPerk)); db.Commands[0].Parameters.Add(new Parameter("@TglProses", SqlDbType.Date, Convert.ToDateTime(Tools.isNull(dr["tgl_proses"], "")))); db.Commands[0].Parameters.Add(new Parameter("@RpAkhir", SqlDbType.Money, Tools.isNull(dr["akhir"], "0"))); db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID)); db.Commands[0].ExecuteNonQuery(); progressBar1.Increment(1); nProgress = nProgress + 1; labelProgress.Text = progressBar1.Value.ToString().Trim() + "/" + progressBar1.Maximum.ToString().Trim(); labelProgress.Refresh(); } } } }