private void SaveJournal(string subAccountId, ListOfJournalStatus listOfJournalStatus) { TJournal jur = new TJournal(); MSubAccount sub = (MSubAccount)DataMaster.GetObjectByProperty(typeof(MSubAccount), MSubAccount.ColumnNames.SubAccountId, subAccountId); MAccount acc = new MAccount(); if (sub != null) { acc = (MAccount)DataMaster.GetObjectByProperty(typeof(MAccount), MAccount.ColumnNames.AccountId, sub.AccountId); if (acc == null) { acc = new MAccount(); } } else { sub = new MSubAccount(); } if (acc.AccountStatus == listOfJournalStatus.ToString()) { jur.AccountSaldo = acc.AccountSaldo + GrandTotalNumericUpDown.Value; jur.SubAccontSaldo = sub.SubAccountSaldo + GrandTotalNumericUpDown.Value; } else { jur.AccountSaldo = acc.AccountSaldo - GrandTotalNumericUpDown.Value; jur.SubAccontSaldo = sub.SubAccountSaldo - GrandTotalNumericUpDown.Value; } jur.JournalDate = DateTime.Now; jur.JournalDesc = namaTransaksi + transactionFacturTextBox.Text; jur.JournalJumlah = GrandTotalNumericUpDown.Value; jur.JournalPic = transactionByTextBox.Text; jur.JournalStatus = listOfJournalStatus.ToString(); jur.SubAccountId = subAccountId; jur.ModifiedBy = lbl_UserName.Text; jur.ModifiedDate = DateTime.Now; DataMaster.SavePersistence(jur); //update saldo sub account sub.SubAccountSaldo = jur.SubAccontSaldo; sub.ModifiedBy = lbl_UserName.Text; sub.ModifiedDate = DateTime.Now; DataMaster.UpdatePersistence(sub); //update saldo account acc.AccountSaldo = jur.AccountSaldo; acc.ModifiedBy = lbl_UserName.Text; acc.ModifiedDate = DateTime.Now; DataMaster.UpdatePersistence(acc); }
private void SaveTransactionJournal(string subAccountId, ListOfJournalStatus listOfJournalStatus, decimal saldo, string desc, string pic) { TJournal jur = new TJournal(); jur.JournalDate = DateTime.Now; jur.JournalDesc = desc; jur.JournalJumlah = saldo; jur.JournalPic = pic; jur.JournalStatus = listOfJournalStatus.ToString(); jur.SubAccountId = subAccountId; jur.VoucherNo = voucherNo; jur.TransactionId = delId; jur.ModifiedBy = lbl_UserName.Text; jur.ModifiedDate = DateTime.Now; AppCode.SaveTJournal(jur); }