Example #1
0
        public static void InvalidateJournalEntry(GLJournalEntrysInfo entry, GLJournalVouchersInfo voucher)
        {
            if (entry == null)
            {
                return;
            }

            if (voucher != null)
            {
                BusinessObjectHelper.CopyFKFields(voucher, entry, true);

                entry.FK_GLJournalVoucherID = voucher.GLJournalVoucherID;
                entry.ApprovalStatus        = voucher.ApprovalStatus;
                entry.JournalDate           = voucher.JournalDate;

                if (String.IsNullOrWhiteSpace(entry.Voucher))
                {
                    entry.Voucher = voucher.Voucher;
                }

                if (String.IsNullOrWhiteSpace(entry.VoucherContent))
                {
                    entry.VoucherContent = voucher.VoucherContent;
                }

                if (entry.VoucherDate.HasValue == false)
                {
                    entry.VoucherDate = voucher.VoucherDate;
                }
            }

            if (entry.EntryType == ABCCommon.ABCConstString.EntryTypeERP)
            {
                if (entry.RaiseAmtTot != entry.AmtTot || entry.FK_GLAccountID_RaiseDebit.HasValue == false || entry.FK_GLAccountID_RaiseDebit.Value != entry.FK_GLAccountID_Debit ||
                    entry.FK_GLAccountID_RaiseCredit.HasValue == false || entry.FK_GLAccountID_RaiseCredit.Value != entry.FK_GLAccountID_Credit)
                {
                    entry.EntryType = ABCCommon.ABCConstString.EntryTypeERPModified;
                }
            }
            if (String.IsNullOrWhiteSpace(entry.EntryType))
            {
                entry.EntryType = ABCCommon.ABCConstString.EntryTypeNormal;
            }

            #region ObjectDesc
            entry.ObjectDesc = BusinessObjectHelper.GetNameValue("FK_ASFixedAssetID", entry.FK_ASFixedAssetID);
            if (String.IsNullOrWhiteSpace(entry.ObjectDesc))
            {
                entry.ObjectDesc = BusinessObjectHelper.GetNameValue("FK_HREmployeeID", entry.FK_HREmployeeID);
            }
            if (String.IsNullOrWhiteSpace(entry.ObjectDesc))
            {
                entry.ObjectDesc = BusinessObjectHelper.GetNameValue("MAPartners", entry.FK_MAPartnerID);
            }
            if (String.IsNullOrWhiteSpace(entry.ObjectDesc))
            {
                entry.ObjectDesc = BusinessObjectHelper.GetNameValue("FK_GECompanyUnitID", entry.FK_GECompanyUnitID);
            }

            if (String.IsNullOrWhiteSpace(entry.ObjectDesc))
            {
                entry.ObjectDesc = BusinessObjectHelper.GetNameValue("FK_GLMonitorObjectID", entry.FK_GLMonitorObjectID);
            }
            if (String.IsNullOrWhiteSpace(entry.ObjectDesc))
            {
                entry.ObjectDesc = BusinessObjectHelper.GetNameValue("FK_PMProjectID", entry.FK_PMProjectID);
            }
            if (String.IsNullOrWhiteSpace(entry.ObjectDesc))
            {
                entry.ObjectDesc = BusinessObjectHelper.GetNameValue("FK_COCostGroupID", entry.FK_COCostGroupID);
            }
            if (String.IsNullOrWhiteSpace(entry.ObjectDesc))
            {
                entry.ObjectDesc = BusinessObjectHelper.GetNameValue("FK_GEBankAccountID", entry.FK_GEBankAccountID);
            }
            #endregion
        }