📄 editpayment.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 */import java.util.*; import com.opensourcestrategies.financials.accounts.AccountsHelper;import org.ofbiz.base.util.*;import org.ofbiz.entity.*;import org.ofbiz.entity.condition.*;import org.ofbiz.accounting.util.*;//Data Prep for Editing a PaymentpaymentTypeId="RECEIPT";currencyUomId="";boolean isDisbursement = false; // by default, assuming that it's a receipt (wishful thinking?)paymentId = parameters.get("paymentId");if (paymentId == null) { paymentId = request.getParameter("paymentId");}if (paymentId != null) { paymentValue = delegator.findByPrimaryKey("Payment",UtilMisc.toMap("paymentId",paymentId)); if (paymentValue != null) { context.put("paymentValue",paymentValue); isDisbursement = UtilAccounting.isDisbursement(paymentValue); if(isDisbursement){ paymentTypeId="DISBURSEMENT"; } context.put("paymentTypeId",paymentTypeId); } else { request.setAttribute("_ERROR_MESSAGE_", "ERROR: paymentId is invalid, Please check paymentId and retry"); return "error"; } currencyUomId = paymentValue.get("currencyUomId"); if (currencyUomId ==null) { Debug.logError("currencyUomId is Null" + paymentValue,"editPayment.bsh" ); } paymentMethodTypeId = paymentValue.get("paymentMethodTypeId"); if (paymentMethodTypeId == null) { Debug.logError("paymentMethodTypeId is Null" + paymentValue,"editPayment.bsh" ); }} else { paymentTypeId = request.getParameter("paymentTypeId"); if (paymentTypeId == null || ((!paymentTypeId.equals("RECEIPT") && !paymentTypeId.equals("DISBURSEMENT")))) { request.setAttribute("_ERROR_MESSAGE_", "ERROR: Required parameter paymentTypeId is Null. It should be set to RECEIPT or DISBURSEMENT"); } else { paymentTypeId = paymentTypeId; if (paymentTypeId.equals("DISBURSEMENT")) { isDisbursement = true; } }}context.put("isDisbursement",isDisbursement);organizationPartyId = context.get("organizationPartyId");context.put("organizationPartyId",organizationPartyId);organizationParty = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", organizationPartyId));supportedPaymentTypes = null;if (isDisbursement) { parameters.put("headerItem","payables"); paymentMethodList = organizationParty.getRelated("PaymentMethod", UtilMisc.toList("paymentMethodTypeId")); context.put("paymentMethodList",paymentMethodList); supportedPaymentTypes = UtilMisc.toList("CUSTOMER_REFUND", "VENDOR_PAYMENT", "VENDOR_PREPAY", "SALES_TAX_PAYMENT", "INCOME_TAX_PAYMENT", "PAYROLL_TAX_PAYMENT");} else { parameters.put("headerItem","receivables"); paymentMethodTypeList = delegator.findAllCache("PaymentMethodType", UtilMisc.toList("description")); context.put("paymentMethodTypeList",paymentMethodTypeList); supportedPaymentTypes = UtilMisc.toList("CUSTOMER_PAYMENT", "CUSTOMER_DEPOSIT");}paymentTypeList = delegator.findByAnd("PaymentType", UtilMisc.toList(new EntityExpr("paymentTypeId", EntityOperator.IN, supportedPaymentTypes))); // no _Cache version availablecontext.put("paymentTypeList", paymentTypeList);if (currencyUomId == null || currencyUomId.equals("")) { Debug.logInfo("currencyUomId is Null Getting From Preference" + currencyUomId, "editPayment.bsh" ); partyAcctgPreference = organizationParty.getRelatedOneCache("PartyAcctgPreference"); if (partyAcctgPreference != null) { currencyUomId=partyAcctgPreference.get("baseCurrencyUomId"); }}context.put("currencyUomId",currencyUomId);currencyUoms = delegator.findByAndCache("Uom",UtilMisc.toMap("uomTypeId","CURRENCY_MEASURE"));context.put("currencyUoms",currencyUoms);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -