⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customervendorstatement.bsh

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 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 * *//** * Generates the report for a customer or vendor statement. * This report displays all the transaction entries for a * given date range between the organizationPartyId and the * customer or vendor partyId.  * * @author Leon Torres (leon@opensourcestrategies.com) * @author Si Chen (sichen@opensourcestrategies.com) */import java.util.*;import java.sql.Timestamp;import org.ofbiz.entity.*;import org.ofbiz.entity.util.*;import org.ofbiz.entity.condition.*;import org.ofbiz.base.util.*;import org.ofbiz.service.*;import com.opensourcestrategies.financials.accounts.AccountsHelper;// the screen should tell us whether we're looking at vendors or customersroleTypeId = context.get("roleTypeId");if (roleTypeId == null) return;// we need the party from a partyId (form or parameter or whatever)partyId = request.getParameter("partyId");if (partyId == null) partyId = parameters.get("partyId");context.put("partyId", partyId);// are we a customer or vendor statement?isCustomer = roleTypeId.equals("BILL_TO_CUSTOMER");isVendor = roleTypeId.equals("BILL_FROM_VENDOR");if (!isCustomer && !isVendor) return;context.put("isCustomer", isCustomer);// tell the form that we want partyId inputpartyLabel = (isCustomer ? "FinancialsCustomer" : "FinancialsVendor");context.put("partyIdInputRequested", UtilMisc.toMap("label", partyLabel));// get these from the common form parsing scriptorganizationPartyId = context.get("organizationPartyId");glFiscalTypeId = context.get("glFiscalTypeId");// make sure the party existsparty = delegator.findByPrimaryKeyCache("Party", UtilMisc.toMap("partyId", partyId));if (party == null) return;// make sure the party has or had this role if (party.getRelatedByAnd("PartyRole", UtilMisc.toMap("roleTypeId", roleTypeId)).size() == 0) return;// get dates back from the contextfromDate = context.get("fromDate");thruDate = context.get("thruDate");if (fromDate == null || thruDate == null) return;// our organizationorganizationPartyId = session.getAttribute("organizationPartyId");// the account typeglAccountTypeId = (isCustomer ? "ACCOUNTS_RECEIVABLE" : "ACCOUNTS_PAYABLE");// make our conditionconditions = UtilMisc.toList(        new EntityExpr("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate),        new EntityExpr("transactionDate", EntityOperator.GREATER_THAN, fromDate),        new EntityExpr("organizationPartyId", EntityOperator.EQUALS, organizationPartyId),        new EntityExpr("partyId", EntityOperator.EQUALS, partyId),        new EntityExpr("isPosted", EntityOperator.EQUALS, "Y"),        new EntityExpr("glAccountTypeId", EntityOperator.EQUALS, glAccountTypeId));findConditions = new EntityConditionList(conditions, EntityOperator.AND);// get transactions ordered by transactionDatetransactions = delegator.findByCondition("AcctgTransAndEntries", findConditions, null, UtilMisc.toList("transactionDate"));context.put("transactions", transactions);// next get the beginning balances for this party.  ending balances are calculated on the .FTLbeginningBalance = null;if (isCustomer) {    beginningBalance = AccountsHelper.getBalanceForCustomerPartyId(partyId, organizationPartyId, glFiscalTypeId, fromDate, delegator);} else {    beginningBalance = AccountsHelper.getBalanceForVendorPartyId(partyId, organizationPartyId, glFiscalTypeId, fromDate, delegator);}context.put("beginningBalance", beginningBalance);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -