private bool ValidateClosing() { period = numericUpDown_Year.Value.ToString() + comboBox_Month.SelectedValue.ToString(); TRekapSubAccount rekap = (TRekapSubAccount)DataMaster.GetObjectByProperty(typeof(TRekapSubAccount), TRekapSubAccount.ColumnNames.RekapSubAccountPeriode, period); if (rekap != null) { if (MessageBox.Show("Proses akhir bulan " + comboBox_Month.Text + " " + numericUpDown_Year.Value.ToString() + " sudah dilakukan. Anda yakin melanjutkan ?", AppCode.AssemblyProduct, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return(false); } } string today = DateTime.Today.Month.ToString(); if (DateTime.Today.Month < 10) { today = decimal.Zero.ToString() + DateTime.Today.Month.ToString(); } today = DateTime.Today.Year.ToString() + today; if (Convert.ToDecimal(today) <= Convert.ToDecimal(period)) { if (MessageBox.Show("Proses akhir bulan hanya bisa dilakukan untuk periode bulan sebelumnya. Anda yakin melanjutkan ?", AppCode.AssemblyProduct, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return(false); } } //IList listAcc = DataMaster.GetAll(typeof(MAccount)); //MAccount acc; //decimal totDebet = 0; //decimal totKredit = 0; //for (int i = 0; i < listAcc.Count; i++) //{ // acc = (MAccount)listAcc[i]; // if (acc.AccountStatus == ListOfJournalStatus.Debet.ToString()) // totDebet += acc.AccountSaldo; // else if (acc.AccountStatus == ListOfJournalStatus.Kredit.ToString()) // totKredit += acc.AccountSaldo; //} //if (totKredit != totDebet) //{ // decimal selisih = totDebet - totKredit; // if (selisih < 0) // selisih = selisih * -1; // MessageBox.Show("Proses akhir bulan belum dapat dilakukan, terjadi selisih sebesar " + ModuleControlSettings.NumericFormat(selisih, true), AppCode.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Warning); // return false; //} return(true); }
private void SaveRekap(listAcc acc, string desc, decimal salesTot) { //period = numericUpDown_Year.Value.ToString() + comboBox_Month.SelectedValue.ToString(); TRekapSubAccount rekap = (TRekapSubAccount)DataMaster.GetObjectByProperty(typeof(TRekapSubAccount), TRekapSubAccount.ColumnNames.RekapSubAccountPeriode, period, TRekapSubAccount.ColumnNames.SubAccountId, acc.ToString()); if (rekap == null) { rekap = new TRekapSubAccount(); } rekap.ModifiedBy = lbl_UserName.Text; rekap.ModifiedDate = DateTime.Now; rekap.RekapSubaccountDesc = desc; rekap.RekapSubAccountPeriode = period; rekap.RekapSubaccountSaldo = salesTot; rekap.SubAccountId = acc.ToString(); DataMaster.SaveOrUpdate(rekap); }