📄 reconcileglaccount.bsh
字号:
/* * Copyright (C) 2006 Open Source Strategies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * @author Leon Torres (leon@opensourcestrategies.org) */import org.ofbiz.base.util.*;import org.ofbiz.entity.*;import org.ofbiz.entity.condition.*;import org.ofbiz.accounting.util.UtilAccounting; delegator = request.getAttribute("delegator");security = request.getAttribute("security");if(security.hasEntityPermission("ACCOUNTING", "_VIEW", session)) { context.put("hasPermission", Boolean.TRUE);} else { context.put("hasPermission", Boolean.FALSE);}glAccountId = request.getParameter("glAccountId");organizationPartyId = session.getAttribute("organizationPartyId");context.put("organizationPartyId", organizationPartyId);// Get the GlAccountglAccount = delegator.findByPrimaryKey("GlAccount", UtilMisc.toMap("glAccountId", glAccountId));context.put("glAccount", glAccount);// base type of accountif (UtilAccounting.isDebitAccount(glAccount)) { context.put("accountIsDebit", "TRUE");} else { context.put("accountIsDebit", "FALSE");}// get the date of latest GlReconciliation, if existsglReconciliations = delegator.findByAnd("GlReconciliation", UtilMisc.toMap("glAccountId", glAccountId), UtilMisc.toList("reconciledDate DESC"));if (glReconciliations != null && glReconciliations.size() > 0) { context.put("lastReconciledDate", glReconciliations.get(0).get("reconciledDate")); context.put("lastReconciledBalance", glReconciliations.get(0).get("reconciledBalance"));} else { context.put("lastReconciledBalance", new Double(0.0));}// get all related, posted, and not AES_RECONCILED AcctgTransAndEntriescondition = new EntityConditionList( UtilMisc.toList( new EntityExpr("glAccountId", EntityOperator.EQUALS, glAccountId), new EntityExpr("isPosted", EntityOperator.EQUALS, "Y"), new EntityConditionList( // NOTE: for some reason, NOT_EQUAL AES_RECONCILED didn't work -- probably a trinary logic issue with null UtilMisc.toList( new EntityExpr("reconcileStatusId", EntityOperator.EQUALS, "AES_NOT_RECONCILED"), new EntityExpr("reconcileStatusId", EntityOperator.EQUALS, "AES_PARTLY_RECON"), new EntityExpr("reconcileStatusId", EntityOperator.EQUALS, null) ), EntityOperator.OR ) ), EntityOperator.AND);orderBy = UtilMisc.toList("acctgTransId", "acctgTransEntrySeqId");entries = delegator.findByCondition("AcctgTransAndEntries", condition, null, orderBy);context.put("entries", entries);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -