You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by wp...@apache.org on 2023/07/27 12:59:57 UTC
[ofbiz-framework] 04/07: Improved: Moves groovy scripts to src and adds a package declaration to all of them (OFBIZ-12813)
This is an automated email from the ASF dual-hosted git repository.
wpaetzold pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit 7c3e32d9f98ec21609acd07ec4de5cb512a3f9b1
Author: Wiebke Pätzold <Wi...@ecomify.de>
AuthorDate: Tue Jul 25 20:29:38 2023 +0200
Improved: Moves groovy scripts to src and adds a package declaration to
all of them (OFBIZ-12813)
---
.../groovyScripts/admin/AcctgAdminServices.groovy | 170 ---
.../groovyScripts/admin/FilterOutReceipts.groovy | 23 -
.../admin/ListInvoiceItemTypesGlAccount.groovy | 54 -
.../agreement/AgreementServices.groovy | 84 --
.../agreement/GetPartyNameForDate.groovy | 24 -
.../ap/invoices/CommissionReport.groovy | 106 --
.../groovyScripts/ap/invoices/CommissionRun.groovy | 48 -
.../groovyScripts/ar/BatchPayments.groovy | 81 --
.../groovyScripts/budget/BudgetServices.groovy | 34 -
.../chartofaccounts/TaxAuthorityGlAccounts.groovy | 24 -
.../fixedasset/FixedAssetGeoLocation.groovy | 44 -
.../invoice/CreateApplicationList.groovy | 75 --
.../groovyScripts/invoice/EditInvoice.groovy | 156 ---
.../invoice/GetAccountOrganizationAndClass.groovy | 83 --
.../groovyScripts/invoice/InvoiceEvents.groovy | 55 -
.../groovyScripts/invoice/InvoiceReport.groovy | 59 -
.../groovyScripts/invoice/InvoiceServices.groovy | 135 --
.../invoice/ListNotAppliedPayments.groovy | 82 --
.../groovyScripts/invoice/PrintInvoices.groovy | 133 --
.../ledger/GeneralLedgerServices.groovy | 34 -
.../order/BillingAccountOrders.groovy | 37 -
.../groovyScripts/payment/BillingAccounts.groovy | 34 -
.../payment/DepositWithdrawPayments.groovy | 69 -
.../payment/FindInvoicesByDueDate.groovy | 28 -
.../payment/ListNotAppliedInvoices.groovy | 91 --
.../payment/ListNotAppliedPayments.groovy | 80 --
.../groovyScripts/payment/ManualTx.groovy | 88 --
.../groovyScripts/payment/PaymentServices.groovy | 961 --------------
.../groovyScripts/payment/PrintChecks.groovy | 64 -
.../period/EditCustomTimePeriod.groovy | 82 --
.../groovyScripts/rate/RateServices.groovy | 275 ----
.../groovyScripts/reports/BalanceSheet.groovy | 364 -----
.../groovyScripts/reports/CashFlowStatement.groovy | 225 ----
.../reports/ComparativeBalanceSheet.groovy | 97 --
.../reports/ComparativeCashFlowStatement.groovy | 102 --
.../reports/ComparativeIncomeStatement.groovy | 97 --
.../groovyScripts/reports/CostCenters.groovy | 77 --
.../reports/GlAccountTrialBalance.groovy | 109 --
.../groovyScripts/reports/IncomeStatement.groovy | 393 ------
.../InvoiceAcctgTransEntryParameters.groovy | 65 -
.../groovyScripts/reports/MonthSelection.groovy | 29 -
.../SalesInvoiceByProductCategorySummary.groovy | 181 ---
.../groovyScripts/reports/TransactionTotals.groovy | 346 -----
.../groovyScripts/reports/TrialBalance.groovy | 61 -
.../transaction/AuthorizeTransaction.groovy | 48 -
.../transaction/CaptureTransaction.groovy | 59 -
.../transaction/ViewGatewayResponse.groovy | 57 -
.../accounting/servicedef/services_admin.xml | 10 +-
.../accounting/servicedef/services_agreement.xml | 2 +-
.../accounting/servicedef/services_budget.xml | 2 +-
.../accounting/servicedef/services_cost.xml | 4 +-
.../accounting/servicedef/services_invoice.xml | 6 +-
.../accounting/servicedef/services_ledger.xml | 2 +-
.../accounting/servicedef/services_payment.xml | 48 +-
.../accounting/servicedef/services_rate.xml | 22 +-
.../ofbiz/accounting/AutoAcctgAdminTests.groovy | 253 ----
.../accounting/AutoAcctgAgreementTests.groovy | 87 --
.../ofbiz/accounting/AutoAcctgBudgetTests.groovy | 57 -
.../ofbiz/accounting/AutoAcctgCostTests.groovy | 61 -
.../accounting/AutoAcctgFinAccountTests.groovy | 203 ---
.../accounting/AutoAcctgFixedAssetTests.groovy | 84 --
.../ofbiz/accounting/AutoAcctgInvoiceTests.groovy | 221 ----
.../ofbiz/accounting/AutoAcctgLedgerTests.groovy | 58 -
.../accounting/AutoAcctgPaymentGatewayTests.groovy | 44 -
.../ofbiz/accounting/AutoAcctgPaymentTests.groovy | 95 --
.../accounting/AutoAcctgTransTestsPurchase.groovy | 196 ---
.../accounting/AutoAcctgTransTestsSales.groovy | 243 ----
.../ofbiz/accounting/AutoInvoiceTests.groovy | 305 -----
.../ofbiz/accounting/AutoPaymentTests.groovy | 480 -------
.../apache/ofbiz/accounting/FixedAssetTests.groovy | 147 ---
.../accounting/InvoicePerShipmentTests.groovy | 185 ---
.../accounting/PaymentApplicationTests.groovy | 151 ---
.../org/apache/ofbiz/accounting/RateTests.groovy | 178 ---
.../accounting/admin/AcctgAdminServices.groovy | 173 +++
.../accounting/admin/FilterOutReceipts.groovy | 26 +
.../admin/ListInvoiceItemTypesGlAccount.groovy | 57 +
.../accounting/agreement/AgreementServices.groovy | 87 ++
.../agreement/GetPartyNameForDate.groovy | 27 +
.../accounting/ap/invoices/CommissionReport.groovy | 109 ++
.../accounting/ap/invoices/CommissionRun.groovy | 51 +
.../ofbiz/accounting/ar/BatchPayments.groovy | 84 ++
.../ofbiz/accounting/budget/BudgetServices.groovy | 37 +
.../chartofaccounts/TaxAuthorityGlAccounts.groovy | 27 +
.../fixedasset/FixedAssetGeoLocation.groovy | 47 +
.../invoice/CreateApplicationList.groovy | 78 ++
.../ofbiz/accounting/invoice/EditInvoice.groovy | 159 +++
.../invoice/GetAccountOrganizationAndClass.groovy | 86 ++
.../ofbiz/accounting/invoice/InvoiceEvents.groovy | 55 +
.../ofbiz/accounting/invoice/InvoiceReport.groovy | 62 +
.../accounting/invoice/InvoiceServices.groovy | 138 ++
.../invoice/ListNotAppliedPayments.groovy | 85 ++
.../ofbiz/accounting/invoice/PrintInvoices.groovy | 136 ++
.../accounting/ledger/GeneralLedgerServices.groovy | 37 +
.../accounting/order/BillingAccountOrders.groovy | 40 +
.../accounting/payment/BillingAccounts.groovy | 37 +
.../payment/DepositWithdrawPayments.groovy | 72 +
.../payment/FindInvoicesByDueDate.groovy | 31 +
.../payment/ListNotAppliedInvoices.groovy | 94 ++
.../payment/ListNotAppliedPayments.groovy | 83 ++
.../ofbiz/accounting/payment/ManualTx.groovy | 91 ++
.../accounting/payment/PaymentServices.groovy | 964 ++++++++++++++
.../ofbiz/accounting/payment/PrintChecks.groovy | 67 +
.../accounting/period/EditCustomTimePeriod.groovy | 85 ++
.../ofbiz/accounting/rate/RateServices.groovy | 278 ++++
.../ofbiz/accounting/reports/BalanceSheet.groovy | 367 +++++
.../accounting/reports/CashFlowStatement.groovy | 228 ++++
.../reports/ComparativeBalanceSheet.groovy | 100 ++
.../reports/ComparativeCashFlowStatement.groovy | 105 ++
.../reports/ComparativeIncomeStatement.groovy | 100 ++
.../ofbiz/accounting/reports/CostCenters.groovy | 80 ++
.../reports/GlAccountTrialBalance.groovy | 112 ++
.../accounting/reports/IncomeStatement.groovy | 396 ++++++
.../InvoiceAcctgTransEntryParameters.groovy | 68 +
.../ofbiz/accounting/reports/MonthSelection.groovy | 32 +
.../SalesInvoiceByProductCategorySummary.groovy | 184 +++
.../accounting/reports/TransactionTotals.groovy | 349 +++++
.../ofbiz/accounting/reports/TrialBalance.groovy | 64 +
.../transaction/AuthorizeTransaction.groovy | 51 +
.../transaction/CaptureTransaction.groovy | 62 +
.../transaction/ViewGatewayResponse.groovy | 60 +
.../accounting/AutoAcctgAdminTests.groovy | 253 ++++
.../accounting/AutoAcctgAgreementTests.groovy | 87 ++
.../accounting/AutoAcctgBudgetTests.groovy | 57 +
.../accounting/AutoAcctgCostTests.groovy | 61 +
.../accounting/AutoAcctgFinAccountTests.groovy | 203 +++
.../accounting/AutoAcctgFixedAssetTests.groovy | 84 ++
.../accounting/AutoAcctgInvoiceTests.groovy | 221 ++++
.../accounting/AutoAcctgLedgerTests.groovy | 58 +
.../accounting/AutoAcctgPaymentGatewayTests.groovy | 44 +
.../accounting/AutoAcctgPaymentTests.groovy | 95 ++
.../accounting/AutoAcctgTransTestsPurchase.groovy | 196 +++
.../accounting/AutoAcctgTransTestsSales.groovy | 243 ++++
.../accounting/accounting/AutoInvoiceTests.groovy | 305 +++++
.../accounting/accounting/AutoPaymentTests.groovy | 480 +++++++
.../accounting/accounting/FixedAssetTests.groovy | 147 +++
.../accounting/InvoicePerShipmentTests.groovy | 185 +++
.../accounting/PaymentApplicationTests.groovy | 151 +++
.../apache/accounting/accounting/RateTests.groovy | 178 +++
.../webapp/accounting/WEB-INF/controller.xml | 2 +-
.../accounting/widget/AccountingPrintScreens.xml | 8 +-
applications/accounting/widget/AgreementForms.xml | 2 +-
.../accounting/widget/BillingAccountScreens.xml | 4 +-
.../accounting/widget/FinAccountScreens.xml | 4 +-
.../accounting/widget/FixedAssetScreens.xml | 2 +-
applications/accounting/widget/GlScreens.xml | 4 +-
applications/accounting/widget/GlSetupForms.xml | 6 +-
applications/accounting/widget/GlSetupScreens.xml | 2 +-
applications/accounting/widget/InvoiceScreens.xml | 10 +-
applications/accounting/widget/PaymentScreens.xml | 14 +-
applications/accounting/widget/PeriodScreens.xml | 2 +-
.../widget/ReportFinancialSummaryScreens.xml | 100 +-
.../accounting/widget/TransactionScreens.xml | 6 +-
.../accounting/widget/ap/ApPrintScreens.xml | 2 +-
.../accounting/widget/ap/CommonScreens.xml | 2 +-
.../accounting/widget/ap/InvoiceScreens.xml | 6 +-
.../accounting/widget/ar/ArPaymentScreens.xml | 2 +-
.../accounting/widget/ar/CommonScreens.xml | 2 +-
.../accounting/widget/ar/InvoiceScreens.xml | 2 +-
.../ofbizsetup/ChangeOrgPartyId.groovy | 34 -
.../groovyScripts/ofbizsetup/FindFacility.groovy | 58 -
.../groovyScripts/ofbizsetup/GetProdCatalog.groovy | 126 --
.../ofbizsetup/GetProductStoreAndWebSite.groovy | 38 -
.../ofbizsetup/SystemInfoServices.groovy | 104 --
.../groovyScripts/template/DocTypeTemplate.groovy | 77 --
applications/commonext/servicedef/services.xml | 12 +-
.../commonext/ofbizsetup/ChangeOrgPartyId.groovy | 37 +
.../ofbiz/commonext/ofbizsetup/FindFacility.groovy | 61 +
.../commonext/ofbizsetup/GetProdCatalog.groovy | 129 ++
.../ofbizsetup/GetProductStoreAndWebSite.groovy | 41 +
.../commonext/ofbizsetup/SystemInfoServices.groovy | 107 ++
.../commonext/template/DocTypeTemplate.groovy | 77 ++
applications/commonext/widget/CommonScreens.xml | 2 +-
.../commonext/widget/ofbizsetup/SetupScreens.xml | 14 +-
.../groovyScripts/cms/CmsEditAddPrep.groovy | 87 --
.../content/groovyScripts/cms/FeaturePrep.groovy | 45 -
.../groovyScripts/cms/GetMenuContext.groovy | 26 -
.../groovyScripts/cms/MostRecentPrep.groovy | 45 -
.../content/groovyScripts/cms/UserPermPrep.groovy | 57 -
.../content/ContentSearchOptions.groovy | 60 -
.../content/ContentSearchResults.groovy | 34 -
.../groovyScripts/content/ContentServices.groovy | 746 -----------
.../content/GetContentLookupList.groovy | 109 --
.../content/groovyScripts/content/PrepSeqNo.groovy | 28 -
.../groovyScripts/contentsetup/UserPermPrep.groovy | 58 -
.../content/groovyScripts/data/DataServices.groovy | 369 ------
.../datasetup/DataCategoryPrep.groovy | 35 -
.../groovyScripts/layout/EditSubContent.groovy | 46 -
.../permission/ContentPermissionServices.groovy | 551 --------
.../groovyScripts/print/FindPrinters.groovy | 23 -
.../survey/EditSurveyQuestions.groovy | 97 --
.../groovyScripts/survey/EditSurveyResponse.groovy | 40 -
.../survey/ViewSurveyResponses.groovy | 41 -
.../website/EditWebSiteParties.groovy | 32 -
.../website/WebSiteCMSMetaInfo.groovy | 49 -
.../website/WebSitePublishPoint.groovy | 43 -
.../permission/DataResourcePermissionServices.xml | 2 +-
applications/content/servicedef/services.xml | 30 +-
.../content/servicedef/services_commevent.xml | 4 +-
.../content/servicedef/services_content.xml | 26 +-
applications/content/servicedef/services_data.xml | 6 +-
.../org/apache/ofbiz/content/ContentTests.groovy | 189 ---
.../apache/ofbiz/content/cms/CmsEditAddPrep.groovy | 90 ++
.../apache/ofbiz/content/cms/FeaturePrep.groovy | 48 +
.../apache/ofbiz/content/cms/GetMenuContext.groovy | 29 +
.../apache/ofbiz/content/cms/MostRecentPrep.groovy | 48 +
.../apache/ofbiz/content/cms/UserPermPrep.groovy | 60 +
.../content/content/ContentSearchOptions.groovy | 63 +
.../content/content/ContentSearchResults.groovy | 37 +
.../ofbiz/content/content/ContentServices.groovy | 749 +++++++++++
.../content/content/GetContentLookupList.groovy | 112 ++
.../apache/ofbiz/content/content/PrepSeqNo.groovy | 31 +
.../ofbiz/content/contentsetup/UserPermPrep.groovy | 61 +
.../apache/ofbiz/content/data/DataServices.groovy | 372 ++++++
.../content/datasetup/DataCategoryPrep.groovy | 38 +
.../ofbiz/content/layout/EditSubContent.groovy | 49 +
.../permission/ContentPermissionServices.groovy | 554 ++++++++
.../apache/ofbiz/content/print/FindPrinters.groovy | 26 +
.../content/survey/EditSurveyQuestions.groovy | 100 ++
.../ofbiz/content/survey/EditSurveyResponse.groovy | 43 +
.../content/survey/ViewSurveyResponses.groovy | 44 +
.../content/website/EditWebSiteParties.groovy | 35 +
.../content/website/WebSiteCMSMetaInfo.groovy | 52 +
.../content/website/WebSitePublishPoint.groovy | 46 +
.../org/apache/content/content/ContentTests.groovy | 189 +++
applications/content/widget/SurveyScreens.xml | 6 +-
applications/content/widget/WebSiteScreens.xml | 6 +-
applications/content/widget/cms/CMSScreens.xml | 16 +-
.../content/widget/content/ContentScreens.xml | 22 +-
.../widget/contentsetup/ContentSetupScreens.xml | 2 +-
.../widget/datasetup/DataResourceSetupScreens.xml | 2 +-
.../content/widget/layout/LayoutScreens.xml | 10 +-
.../groovyScripts/category/CategoryTree.groovy | 56 -
.../ofbiz/humanres/category/CategoryTree.groovy | 59 +
applications/humanres/widget/CommonScreens.xml | 4 +-
applications/humanres/widget/EmployeeScreens.xml | 4 +-
.../humanres/widget/PersonTrainingScreens.xml | 10 +-
.../groovyScripts/bom/BomSimulation.groovy | 67 -
.../groovyScripts/bom/EditProductBom.groovy | 95 --
.../groovyScripts/bom/FindProductBom.groovy | 51 -
.../ProductionRunActualComponents.groovy | 28 -
.../jobshopmgt/ProductionRunAllFixedAssets.groovy | 34 -
.../jobshopmgt/ProductionRunComponents.groovy | 28 -
.../jobshopmgt/ProductionRunContent.groovy | 48 -
.../jobshopmgt/ProductionRunCosts.groovy | 32 -
.../jobshopmgt/ProductionRunDeclaration.groovy | 230 ----
.../jobshopmgt/ProductionRunFixedAssets.groovy | 28 -
.../jobshopmgt/ProductionRunServices.groovy | 391 ------
.../jobshopmgt/ProductionRunTaskParties.groovy | 42 -
.../jobshopmgt/ProductionRunTasks.groovy | 30 -
.../jobshopmgt/ShowProductionRun.groovy | 42 -
.../jobshopmgt/ViewProductionRun.groovy | 69 -
.../jobshopmgt/WorkWithShipmentPlans.groovy | 168 ---
.../mrp/FindInventoryEventPlan.groovy | 93 --
.../groovyScripts/reports/CuttingListReport.groovy | 132 --
.../reports/PRunsComponentsByFeature.groovy | 123 --
.../groovyScripts/reports/PRunsInfoAndOrder.groovy | 80 --
.../reports/PRunsProductsAndOrder.groovy | 65 -
.../reports/PRunsProductsByFeature.groovy | 79 --
.../reports/PRunsProductsStacks.groovy | 82 --
.../reports/PackageContentsAndOrder.groovy | 67 -
.../groovyScripts/reports/ShipmentLabel.groovy | 90 --
.../reports/ShipmentPlanStockReport.groovy | 91 --
.../reports/ShipmentWorkEffortTasks.groovy | 75 --
.../groovyScripts/routing/EditCalendar.groovy | 43 -
.../routing/EditCalendarExceptionDay.groovy | 48 -
.../routing/EditCalendarExceptionWeek.groovy | 53 -
.../groovyScripts/routing/RoutingServices.groovy | 126 --
.../servicedef/services_production_run.xml | 10 +-
.../manufacturing/servicedef/services_routing.xml | 4 +-
.../ofbiz/manufacturing/bom/BomSimulation.groovy | 70 +
.../ofbiz/manufacturing/bom/EditProductBom.groovy | 98 ++
.../ofbiz/manufacturing/bom/FindProductBom.groovy | 54 +
.../ProductionRunActualComponents.groovy | 31 +
.../jobshopmgt/ProductionRunAllFixedAssets.groovy | 37 +
.../jobshopmgt/ProductionRunComponents.groovy | 31 +
.../jobshopmgt/ProductionRunContent.groovy | 51 +
.../jobshopmgt/ProductionRunCosts.groovy | 35 +
.../jobshopmgt/ProductionRunDeclaration.groovy | 233 ++++
.../jobshopmgt/ProductionRunFixedAssets.groovy | 31 +
.../jobshopmgt/ProductionRunServices.groovy | 394 ++++++
.../jobshopmgt/ProductionRunTaskParties.groovy | 45 +
.../jobshopmgt/ProductionRunTasks.groovy | 33 +
.../jobshopmgt/ShowProductionRun.groovy | 45 +
.../jobshopmgt/ViewProductionRun.groovy | 72 +
.../jobshopmgt/WorkWithShipmentPlans.groovy | 171 +++
.../mrp/FindInventoryEventPlan.groovy | 96 ++
.../manufacturing/reports/CuttingListReport.groovy | 135 ++
.../reports/PRunsComponentsByFeature.groovy | 126 ++
.../manufacturing/reports/PRunsInfoAndOrder.groovy | 83 ++
.../reports/PRunsProductsAndOrder.groovy | 68 +
.../reports/PRunsProductsByFeature.groovy | 82 ++
.../reports/PRunsProductsStacks.groovy | 85 ++
.../reports/PackageContentsAndOrder.groovy | 70 +
.../manufacturing/reports/ShipmentLabel.groovy | 93 ++
.../reports/ShipmentPlanStockReport.groovy | 94 ++
.../reports/ShipmentWorkEffortTasks.groovy | 78 ++
.../manufacturing/routing/EditCalendar.groovy | 46 +
.../routing/EditCalendarExceptionDay.groovy | 51 +
.../routing/EditCalendarExceptionWeek.groovy | 56 +
.../manufacturing/routing/RoutingServices.groovy | 129 ++
.../webapp/manufacturing/WEB-INF/controller.xml | 2 +-
.../widget/manufacturing/BomScreens.xml | 6 +-
.../widget/manufacturing/CalendarScreens.xml | 6 +-
.../widget/manufacturing/JobshopScreens.xml | 26 +-
.../widget/manufacturing/MrpScreens.xml | 2 +-
.../widget/manufacturing/ReportScreens.xml | 24 +-
.../contact/GetContactListMarketingEmail.groovy | 34 -
.../marketing/reports/EmailStatusReport.groovy | 47 -
.../reports/MarketingCampaignReport.groovy | 56 -
.../marketing/reports/PartyStatusReport.groovy | 40 -
.../marketing/reports/TrackingCodeReport.groovy | 55 -
.../marketing/groovyScripts/sfa/CloneLead.groovy | 95 --
.../groovyScripts/sfa/MergeContacts.groovy | 79 --
.../sfa/account/AccountServices.groovy | 43 -
.../groovyScripts/sfa/lead/LeadServices.groovy | 201 ---
applications/marketing/servicedef/services.xml | 6 +-
.../apache/ofbiz/marketing/MarketingTests.groovy | 83 --
.../contact/GetContactListMarketingEmail.groovy | 37 +
.../marketing/reports/EmailStatusReport.groovy | 50 +
.../reports/MarketingCampaignReport.groovy | 59 +
.../marketing/reports/PartyStatusReport.groovy | 43 +
.../marketing/reports/TrackingCodeReport.groovy | 58 +
.../apache/ofbiz/marketing/sfa/CloneLead.groovy | 98 ++
.../ofbiz/marketing/sfa/MergeContacts.groovy | 82 ++
.../marketing/sfa/account/AccountServices.groovy | 46 +
.../ofbiz/marketing/sfa/lead/LeadServices.groovy | 204 +++
.../marketing/marketing/MarketingTests.groovy | 83 ++
.../marketing/widget/ContactListScreens.xml | 2 +-
.../marketing/widget/MarketingReportScreens.xml | 8 +-
.../marketing/widget/sfa/CommonScreens.xml | 22 +-
.../marketing/widget/sfa/ContactScreens.xml | 2 +-
applications/marketing/widget/sfa/LeadScreens.xml | 4 +-
.../allocationplan/CreateAllocationPlan.groovy | 105 --
.../allocationplan/ListAllocationPlan.groovy | 78 --
.../allocationplan/ViewAllocationPlan.groovy | 190 ---
.../communications/CommunicationServices.groovy | 42 -
.../groovyScripts/entry/AddGiftCertificates.groovy | 54 -
.../entry/AdditionalPartyListing.groovy | 52 -
.../order/groovyScripts/entry/BillSettings.groovy | 90 --
.../order/groovyScripts/entry/CheckInits.groovy | 60 -
.../groovyScripts/entry/CheckoutOptions.groovy | 98 --
.../groovyScripts/entry/CheckoutPayment.groovy | 58 -
.../groovyScripts/entry/CheckoutReview.groovy | 162 ---
.../entry/CheckoutShippingAddress.groovy | 45 -
.../groovyScripts/entry/OptionSettings.groovy | 71 -
.../groovyScripts/entry/OrderAgreements.groovy | 89 --
.../order/groovyScripts/entry/OrderTerms.groovy | 51 -
.../groovyScripts/entry/SetAdditionalParty.groovy | 39 -
.../groovyScripts/entry/SetCheckOutTabBar.groovy | 63 -
.../groovyScripts/entry/SetShoppingCart.groovy | 27 -
.../order/groovyScripts/entry/ShipSettings.groovy | 123 --
.../order/groovyScripts/entry/ShoppingList.groovy | 27 -
.../order/groovyScripts/entry/ShowCart.groovy | 117 --
.../order/groovyScripts/entry/ShowPromoText.groovy | 66 -
.../order/groovyScripts/entry/SplitShip.groovy | 33 -
.../groovyScripts/entry/StorePaymentOptions.groovy | 31 -
.../entry/cart/LookupBulkAddProducts.groovy | 52 -
.../cart/LookupBulkAddSupplierProducts.groovy | 129 --
.../entry/cart/ShowPromotionDetails.groovy | 80 --
.../entry/catalog/AdvancedSearchOptions.groovy | 59 -
.../groovyScripts/entry/catalog/Category.groovy | 100 --
.../entry/catalog/CategoryDetail.groovy | 105 --
.../entry/catalog/ChooseCatalog.groovy | 46 -
.../entry/catalog/CompareProducts.groovy | 79 --
.../entry/catalog/InlineProductDetail.groovy | 309 -----
.../entry/catalog/KeywordSearch.groovy | 47 -
.../entry/catalog/KeywordSearchOptions.groovy | 39 -
.../entry/catalog/PrepareConfigForm.groovy | 53 -
.../groovyScripts/entry/catalog/Product.groovy | 147 ---
.../entry/catalog/ProductDetail.groovy | 698 ----------
.../entry/catalog/ProductSummary.groovy | 247 ----
.../entry/catalog/ProductUomDropDownOnly.groovy | 39 -
.../groovyScripts/entry/catalog/QuickAdd.groovy | 45 -
.../entry/catalog/SideDeepCategory.groovy | 39 -
.../lookup/LookupAssociatedProducts.groovy | 44 -
.../groovyScripts/order/AddOrderAttachments.groovy | 27 -
.../groovyScripts/order/CheckoutServices.groovy | 204 ---
.../order/groovyScripts/order/CompanyHeader.groovy | 295 -----
.../groovyScripts/order/FilterOrderList.groovy | 83 --
.../order/groovyScripts/order/FindOrders.groovy | 179 ---
.../order/groovyScripts/order/NewNote.groovy | 43 -
.../order/OrderDeliveryScheduleInfo.groovy | 42 -
.../order/OrderDeliveryServices.groovy | 163 ---
.../order/groovyScripts/order/OrderHistory.groovy | 132 --
.../order/groovyScripts/order/OrderList.groovy | 56 -
.../order/OrderRequirementServices.groovy | 70 -
.../groovyScripts/order/OrderReturnServices.groovy | 962 --------------
.../order/groovyScripts/order/OrderServices.groovy | 142 --
.../order/groovyScripts/order/OrderStats.groovy | 245 ----
.../order/groovyScripts/order/OrderView.groovy | 576 --------
.../groovyScripts/order/OrderViewWebSecure.groovy | 72 -
.../groovyScripts/order/ReceivePayment.groovy | 47 -
.../order/SendConfirmationEmail.groovy | 43 -
.../order/groovyScripts/order/ShipGroups.groovy | 126 --
.../order/groovyScripts/order/ViewImage.groovy | 36 -
.../groovyScripts/orderReturn/QuickReturn.groovy | 97 --
.../groovyScripts/orderReturn/ReturnHeader.groovy | 109 --
.../groovyScripts/orderReturn/ReturnHistory.groovy | 41 -
.../groovyScripts/orderReturn/ReturnItems.groovy | 93 --
.../groovyScripts/quote/GetPartyAddress.groovy | 30 -
.../quote/GetPartyEmailAddress.groovy | 29 -
.../groovyScripts/quote/ManageQuotePrices.groovy | 80 --
.../order/groovyScripts/quote/QuoteServices.groovy | 718 ----------
.../groovyScripts/quote/ViewQuoteProfit.groovy | 80 --
.../reports/OpenOrderItemsReport.groovy | 173 ---
.../request/GetNextSequenceNum.groovy | 31 -
.../groovyScripts/request/RequestItemNotes.groovy | 32 -
.../groovyScripts/request/SetRequestQuote.groovy | 26 -
.../requirement/ApprovedProductRequirements.groovy | 26 -
.../ApprovedProductRequirementsByVendor.groovy | 40 -
.../requirement/RequirementServices.groovy | 102 --
.../requirement/SelectCreatedProposed.groovy | 35 -
.../order/groovyScripts/setup/PaymentSetup.groovy | 44 -
.../shoppinglist/ShoppingListServices.groovy | 318 -----
.../order/groovyScripts/task/OrderTaskList.groovy | 108 --
applications/order/servicedef/services.xml | 14 +-
.../order/servicedef/services_checkout.xml | 6 +-
applications/order/servicedef/services_quote.xml | 38 +-
.../order/servicedef/services_requirement.xml | 8 +-
applications/order/servicedef/services_return.xml | 48 +-
.../order/servicedef/services_shoppinglist.xml | 20 +-
.../ofbiz/order/OrderBlacklistServices.groovy | 5 +-
.../ofbiz/order/OrderRequirementTests.groovy | 95 --
.../org/apache/ofbiz/order/OrderReturnTests.groovy | 227 ----
.../org/apache/ofbiz/order/OrderTests.groovy | 108 --
.../org/apache/ofbiz/order/QuoteTests.groovy | 477 -------
.../apache/ofbiz/order/ShoppingListTests.groovy | 154 ---
.../order/TestCustRequestPermissionCheck.groovy | 39 -
.../allocationplan/CreateAllocationPlan.groovy | 108 ++
.../order/allocationplan/ListAllocationPlan.groovy | 81 ++
.../order/allocationplan/ViewAllocationPlan.groovy | 193 +++
.../communications/CommunicationServices.groovy | 45 +
.../ofbiz/order/entry/AddGiftCertificates.groovy | 57 +
.../order/entry/AdditionalPartyListing.groovy | 55 +
.../apache/ofbiz/order/entry/BillSettings.groovy | 93 ++
.../org/apache/ofbiz/order/entry/CheckInits.groovy | 63 +
.../ofbiz/order/entry/CheckoutOptions.groovy | 101 ++
.../ofbiz/order/entry/CheckoutPayment.groovy | 61 +
.../apache/ofbiz/order/entry/CheckoutReview.groovy | 165 +++
.../order/entry/CheckoutShippingAddress.groovy | 48 +
.../apache/ofbiz/order/entry/OptionSettings.groovy | 74 ++
.../ofbiz/order/entry/OrderAgreements.groovy | 92 ++
.../org/apache/ofbiz/order/entry/OrderTerms.groovy | 54 +
.../ofbiz/order/entry/SetAdditionalParty.groovy | 42 +
.../ofbiz/order/entry/SetCheckOutTabBar.groovy | 66 +
.../ofbiz/order/entry/SetShoppingCart.groovy | 30 +
.../apache/ofbiz/order/entry/ShipSettings.groovy | 126 ++
.../apache/ofbiz/order/entry/ShoppingList.groovy | 30 +
.../org/apache/ofbiz/order/entry/ShowCart.groovy | 120 ++
.../apache/ofbiz/order/entry/ShowPromoText.groovy | 69 +
.../org/apache/ofbiz/order/entry/SplitShip.groovy | 36 +
.../ofbiz/order/entry/StorePaymentOptions.groovy | 34 +
.../order/entry/cart/LookupBulkAddProducts.groovy | 55 +
.../cart/LookupBulkAddSupplierProducts.groovy | 132 ++
.../order/entry/cart/ShowPromotionDetails.groovy | 83 ++
.../entry/catalog/AdvancedSearchOptions.groovy | 62 +
.../ofbiz/order/entry/catalog/Category.groovy | 103 ++
.../order/entry/catalog/CategoryDetail.groovy | 108 ++
.../ofbiz/order/entry/catalog/ChooseCatalog.groovy | 49 +
.../order/entry/catalog/CompareProducts.groovy | 82 ++
.../order/entry/catalog/InlineProductDetail.groovy | 312 +++++
.../ofbiz/order/entry/catalog/KeywordSearch.groovy | 50 +
.../entry/catalog/KeywordSearchOptions.groovy | 42 +
.../order/entry/catalog/PrepareConfigForm.groovy | 56 +
.../ofbiz/order/entry/catalog/Product.groovy | 150 +++
.../ofbiz/order/entry/catalog/ProductDetail.groovy | 701 ++++++++++
.../order/entry/catalog/ProductSummary.groovy | 250 ++++
.../entry/catalog/ProductUomDropDownOnly.groovy | 42 +
.../ofbiz/order/entry/catalog/QuickAdd.groovy | 48 +
.../order/entry/catalog/SideDeepCategory.groovy | 42 +
.../order/lookup/LookupAssociatedProducts.groovy | 47 +
.../ofbiz/order/order/AddOrderAttachments.groovy | 30 +
.../ofbiz/order/order/CheckoutServices.groovy | 207 +++
.../apache/ofbiz/order/order/CompanyHeader.groovy | 298 +++++
.../ofbiz/order/order/FilterOrderList.groovy | 86 ++
.../org/apache/ofbiz/order/order/FindOrders.groovy | 182 +++
.../org/apache/ofbiz/order/order/NewNote.groovy | 46 +
.../order/order/OrderDeliveryScheduleInfo.groovy | 45 +
.../ofbiz/order/order/OrderDeliveryServices.groovy | 166 +++
.../apache/ofbiz/order/order/OrderHistory.groovy | 135 ++
.../org/apache/ofbiz/order/order/OrderList.groovy | 59 +
.../order/order/OrderRequirementServices.groovy | 73 +
.../ofbiz/order/order/OrderReturnServices.groovy | 962 ++++++++++++++
.../apache/ofbiz/order/order/OrderServices.groovy | 145 ++
.../org/apache/ofbiz/order/order/OrderStats.groovy | 248 ++++
.../org/apache/ofbiz/order/order/OrderView.groovy | 579 ++++++++
.../ofbiz/order/order/OrderViewWebSecure.groovy | 75 ++
.../apache/ofbiz/order/order/ReceivePayment.groovy | 50 +
.../ofbiz/order/order/SendConfirmationEmail.groovy | 46 +
.../org/apache/ofbiz/order/order/ShipGroups.groovy | 129 ++
.../org/apache/ofbiz/order/order/ViewImage.groovy | 39 +
.../ofbiz/order/orderReturn/QuickReturn.groovy | 100 ++
.../ofbiz/order/orderReturn/ReturnHeader.groovy | 112 ++
.../ofbiz/order/orderReturn/ReturnHistory.groovy | 44 +
.../ofbiz/order/orderReturn/ReturnItems.groovy | 96 ++
.../ofbiz/order/quote/GetPartyAddress.groovy | 33 +
.../ofbiz/order/quote/GetPartyEmailAddress.groovy | 32 +
.../ofbiz/order/quote/ManageQuotePrices.groovy | 83 ++
.../apache/ofbiz/order/quote/QuoteServices.groovy | 721 ++++++++++
.../ofbiz/order/quote/ViewQuoteProfit.groovy | 83 ++
.../order/reports/OpenOrderItemsReport.groovy | 176 +++
.../ofbiz/order/request/GetNextSequenceNum.groovy | 34 +
.../ofbiz/order/request/RequestItemNotes.groovy | 35 +
.../ofbiz/order/request/SetRequestQuote.groovy | 29 +
.../requirement/ApprovedProductRequirements.groovy | 29 +
.../ApprovedProductRequirementsByVendor.groovy | 43 +
.../order/requirement/RequirementServices.groovy | 105 ++
.../order/requirement/SelectCreatedProposed.groovy | 38 +
.../apache/ofbiz/order/setup/PaymentSetup.groovy | 47 +
.../order/shoppinglist/ShoppingListServices.groovy | 321 +++++
.../apache/ofbiz/order/task/OrderTaskList.groovy | 111 ++
.../order/order/OrderRequirementTests.groovy | 95 ++
.../org/apache/order/order/OrderReturnTests.groovy | 227 ++++
.../org/apache/order/order/OrderTests.groovy | 108 ++
.../org/apache/order/order/QuoteTests.groovy | 477 +++++++
.../apache/order/order/ShoppingListTests.groovy | 154 +++
.../order/TestCustRequestPermissionCheck.groovy | 39 +
.../widget/ordermgr/AllocationPlanScreens.xml | 8 +-
.../order/widget/ordermgr/CustRequestScreens.xml | 8 +-
.../widget/ordermgr/OrderEntryCartScreens.xml | 24 +-
.../widget/ordermgr/OrderEntryCatalogScreens.xml | 36 +-
.../widget/ordermgr/OrderEntryCommonScreens.xml | 4 +-
.../widget/ordermgr/OrderEntryOrderScreens.xml | 42 +-
.../order/widget/ordermgr/OrderEntryScreens.xml | 8 +-
.../order/widget/ordermgr/OrderPrintScreens.xml | 14 +-
.../order/widget/ordermgr/OrderReturnScreens.xml | 18 +-
.../order/widget/ordermgr/OrderSetupScreens.xml | 2 +-
.../order/widget/ordermgr/OrderTaskScreens.xml | 2 +-
.../order/widget/ordermgr/OrderViewScreens.xml | 36 +-
.../order/widget/ordermgr/QuoteScreens.xml | 10 +-
.../order/widget/ordermgr/ReportScreens.xml | 2 +-
.../order/widget/ordermgr/RequirementScreens.xml | 6 +-
.../party/groovyScripts/HasPartyPermissions.groovy | 29 -
.../CommunicationEventServices.groovy | 652 ---------
.../communication/FindCommEventContactMechs.groovy | 45 -
.../GetMyCommunicationEventRole.groovy | 28 -
.../communication/GetPartyEmailAttachment.groovy | 36 -
.../GetPartyEmailFromCommEventInfo.groovy | 67 -
.../communication/ListCommunications.groovy | 52 -
.../communication/RecentVisitor.groovy | 36 -
.../contact/ContactMechServices.groovy | 343 -----
.../groovyScripts/party/EditContactMech.groovy | 43 -
.../groovyScripts/party/EditPaymentMethod.groovy | 73 -
.../groovyScripts/party/EditShoppingList.groovy | 146 --
.../party/groovyScripts/party/FindLookUp.groovy | 53 -
.../party/groovyScripts/party/FindMatches.groovy | 52 -
.../party/groovyScripts/party/FindParty.groovy | 39 -
.../groovyScripts/party/GetContactMechs.groovy | 24 -
.../groovyScripts/party/GetCurrentCart.groovy | 27 -
.../groovyScripts/party/GetGeoLocation.groovy | 33 -
.../groovyScripts/party/GetLoyaltyPoints.groovy | 34 -
.../party/groovyScripts/party/GetMyCompany.groovy | 28 -
.../groovyScripts/party/GetPaymentMethods.groovy | 40 -
.../party/GetPostalAddressTemplate.groovy | 30 -
.../party/GetUserLoginPrimaryEmail.groovy | 30 -
.../groovyScripts/party/LookupServices.groovy | 32 -
.../party/PartyFinancialHistory.groovy | 134 --
.../groovyScripts/party/PartyGeoLocation.groovy | 58 -
.../party/PartyInvitationServices.groovy | 77 --
.../party/PartyPermissionServices.groovy | 276 ----
.../party/groovyScripts/party/PartyServices.groovy | 963 --------------
.../groovyScripts/party/PartySimpleMethods.groovy | 95 --
.../party/groovyScripts/party/SetRoleVars.groovy | 54 -
.../groovyScripts/party/StatusCondition.groovy | 27 -
.../party/UnAppliedInvoicesForParty.groovy | 67 -
.../party/UnAppliedPaymentsForParty.groovy | 71 -
.../party/groovyScripts/party/ViewProfile.groovy | 36 -
.../party/groovyScripts/visit/ShowVisits.groovy | 96 --
.../party/groovyScripts/visit/VisitDetails.groovy | 66 -
applications/party/servicedef/services.xml | 110 +-
applications/party/servicedef/services_contact.xml | 18 +-
applications/party/servicedef/services_view.xml | 10 +-
.../ofbiz/party/ContactMechWorkerTests.groovy | 181 ---
.../apache/ofbiz/party/HasPartyPermissions.groovy | 32 +
.../ofbiz/party/PartyContactMechTests.groovy | 435 ------
.../ofbiz/party/PartyStatusChangeTests.groovy | 76 --
.../org/apache/ofbiz/party/PartyTests.groovy | 51 -
.../CommunicationEventServices.groovy | 655 +++++++++
.../communication/FindCommEventContactMechs.groovy | 48 +
.../GetMyCommunicationEventRole.groovy | 31 +
.../communication/GetPartyEmailAttachment.groovy | 39 +
.../GetPartyEmailFromCommEventInfo.groovy | 70 +
.../party/communication/ListCommunications.groovy | 55 +
.../ofbiz/party/communication/RecentVisitor.groovy | 39 +
.../ofbiz/party/contact/ContactMechServices.groovy | 346 +++++
.../ofbiz/party/party/EditContactMech.groovy | 46 +
.../ofbiz/party/party/EditPaymentMethod.groovy | 76 ++
.../ofbiz/party/party/EditShoppingList.groovy | 149 +++
.../org/apache/ofbiz/party/party/FindLookUp.groovy | 56 +
.../apache/ofbiz/party/party/FindMatches.groovy | 55 +
.../org/apache/ofbiz/party/party/FindParty.groovy | 42 +
.../ofbiz/party/party/GetContactMechs.groovy | 27 +
.../apache/ofbiz/party/party/GetCurrentCart.groovy | 30 +
.../apache/ofbiz/party/party/GetGeoLocation.groovy | 36 +
.../ofbiz/party/party/GetLoyaltyPoints.groovy | 37 +
.../apache/ofbiz/party/party/GetMyCompany.groovy | 31 +
.../ofbiz/party/party/GetPaymentMethods.groovy | 43 +
.../party/party/GetPostalAddressTemplate.groovy | 33 +
.../party/party/GetUserLoginPrimaryEmail.groovy | 33 +
.../apache/ofbiz/party/party/LookupServices.groovy | 35 +
.../ofbiz/party/party/PartyFinancialHistory.groovy | 137 ++
.../ofbiz/party/party/PartyGeoLocation.groovy | 61 +
.../party/party/PartyInvitationServices.groovy | 80 ++
.../party/party/PartyPermissionServices.groovy | 279 ++++
.../apache/ofbiz/party/party/PartyServices.groovy | 966 ++++++++++++++
.../ofbiz/party/party/PartySimpleMethods.groovy | 98 ++
.../apache/ofbiz/party/party/SetRoleVars.groovy | 57 +
.../ofbiz/party/party/StatusCondition.groovy | 30 +
.../party/party/UnAppliedInvoicesForParty.groovy | 70 +
.../party/party/UnAppliedPaymentsForParty.groovy | 74 ++
.../apache/ofbiz/party/party/ViewProfile.groovy | 39 +
.../org/apache/ofbiz/party/visit/ShowVisits.groovy | 99 ++
.../apache/ofbiz/party/visit/VisitDetails.groovy | 69 +
.../party/party/ContactMechWorkerTests.groovy | 181 +++
.../party/party/PartyContactMechTests.groovy | 435 ++++++
.../party/party/PartyStatusChangeTests.groovy | 76 ++
.../org/apache/party/party/PartyTests.groovy | 51 +
.../widget/partymgr/CommunicationEventForms.xml | 6 +-
.../widget/partymgr/CommunicationEventScreens.xml | 4 +-
applications/party/widget/partymgr/LookupForms.xml | 20 +-
.../party/widget/partymgr/LookupScreens.xml | 18 +-
applications/party/widget/partymgr/PartyForms.xml | 6 +-
applications/party/widget/partymgr/PartyMenus.xml | 2 +-
.../party/widget/partymgr/PartyScreens.xml | 24 +-
.../party/widget/partymgr/PaymentMethodScreens.xml | 18 +-
.../party/widget/partymgr/ProfileScreens.xml | 10 +-
.../party/widget/partymgr/VisitScreens.xml | 2 +-
.../groovyScripts/catalog/ChooseTopCategory.groovy | 24 -
.../groovyScripts/catalog/FastLoadCache.groovy | 62 -
.../catalog/GetSupplierInventories.groovy | 24 -
.../catalog/PrepareCreateShipMeth.groovy | 31 -
.../PrepareCreateShipmentTimeEstimate.groovy | 33 -
.../catalog/category/CategoryTree.groovy | 84 --
.../CreateProductInCategoryCheckExisting.groovy | 52 -
.../catalog/category/EditCategory.groovy | 128 --
.../category/EditCategoryContentContent.groovy | 57 -
.../catalog/category/EditCategoryProducts.groovy | 43 -
.../catalog/category/EditCategorySEO.groovy | 42 -
.../config/EditProductConfigItemContent.groovy | 140 --
.../EditProductConfigItemContentContent.groovy | 67 -
.../feature/EditFeatureCategoryFeatures.groovy | 108 --
.../catalog/feature/EditFeatureGroups.groovy | 22 -
.../catalog/feature/QuickAddProductFeatures.groovy | 22 -
.../catalog/find/AdvancedSearchOptions.groovy | 64 -
.../catalog/find/KeywordSearch.groovy | 54 -
.../catalog/find/KeywordSearchBox.groovy | 31 -
.../catalog/find/MiniProductList.groovy | 53 -
.../groovyScripts/catalog/find/SideCatalogs.groovy | 46 -
.../catalog/find/SideDeepCategory.groovy | 58 -
.../catalog/imagemanagement/CheckAction.groovy | 39 -
.../catalog/imagemanagement/CheckRejected.groovy | 45 -
.../catalog/imagemanagement/ImageFrame.groovy | 34 -
.../catalog/imagemanagement/ImageGallery.groovy | 47 -
.../imagemanagement/ImageRecentlyApproved.groovy | 94 --
.../catalog/imagemanagement/ImageUpload.groovy | 157 ---
.../catalog/imagemanagement/SeoLocales.groovy | 73 -
.../catalog/imagemanagement/SetDefaultImage.groovy | 187 ---
.../catalog/imagemanagement/SortSequenceNum.groovy | 31 -
.../catalog/lookup/LookupVariantProduct.groovy | 74 --
.../catalog/price/EditProductPriceRules.groovy | 55 -
.../product/ApplyFeaturesFromCategory.groovy | 107 --
.../catalog/product/ApplyFeaturesFromGroup.groovy | 44 -
.../catalog/product/BestProducts.groovy | 104 --
.../catalog/product/EditProductAssoc.groovy | 46 -
.../catalog/product/EditProductContent.groovy | 176 ---
.../product/EditProductContentContent.groovy | 134 --
.../catalog/product/EditProductFeatures.groovy | 29 -
.../product/EditProductInventoryItems.groovy | 169 ---
.../catalog/product/EditProductQuickAdmin.groovy | 318 -----
.../catalog/product/EditProductSEO.groovy | 42 -
.../catalog/product/QuickAddVariants.groovy | 24 -
.../catalog/promo/EditProductPromoCode.groovy | 47 -
.../catalog/store/EditProductStorePaySetup.groovy | 88 --
.../catalog/store/EditProductStoreSurveys.groovy | 39 -
.../catalog/thesaurus/EditKeywordThesaurus.groovy | 70 -
.../facility/ComputeProductSellThroughData.groovy | 41 -
.../CountFacilityInventoryByProduct.groovy | 376 ------
.../facility/facility/EditContactMech.groovy | 60 -
.../facility/facility/EditFacility.groovy | 48 -
.../facility/facility/EditFacilityLocation.groovy | 53 -
.../facility/facility/FacilityGeoServices.groovy | 40 -
.../facility/FacilityLocationGeoLocation.groovy | 50 -
.../facility/facility/FindFacility.groovy | 31 -
.../facility/facility/FindFacilityLocation.groovy | 52 -
.../facility/facility/FindFacilityTransfers.groovy | 64 -
.../facility/FindInventoryItemsByLabels.groovy | 101 --
.../facility/facility/ViewContactMechs.groovy | 41 -
.../facility/ViewFacilityInventoryByProduct.groovy | 223 ----
.../inventory/FindFacilityPhysicalInventory.groovy | 72 -
.../inventory/InventoryAverageCosts.groovy | 47 -
.../facility/inventory/InventoryItemTotals.groovy | 112 --
.../facility/inventory/LookupInventoryItems.groovy | 51 -
.../inventory/PhysicalInventoryVariance.groovy | 34 -
.../facility/inventory/ReceiveInventory.groovy | 269 ----
.../inventory/TransferInventoryItem.groovy | 95 --
.../facility/returns/ReceiveReturn.groovy | 89 --
.../facility/shipment/AddItemsFromInventory.groovy | 58 -
.../facility/shipment/AddItemsFromOrder.groovy | 209 ---
.../facility/shipment/EditShipment.groovy | 57 -
.../facility/shipment/EditShipmentItems.groovy | 62 -
.../facility/shipment/EditShipmentPackages.groovy | 53 -
.../facility/shipment/EditShipmentPlan.groovy | 287 ----
.../shipment/EditShipmentRouteSegments.groovy | 89 --
.../facility/shipment/PackOrder.groovy | 178 ---
.../facility/shipment/PackingSlip.groovy | 127 --
.../facility/shipment/PrintPickSheets.groovy | 133 --
.../facility/shipment/QuickShipOrder.groovy | 79 --
.../ReceiveInventoryAgainstPurchaseOrder.groovy | 265 ----
.../shipment/ReviewOrdersNotPickedOrPacked.groovy | 40 -
.../facility/shipment/ShipmentManifest.groovy | 60 -
.../facility/shipment/VerifyPick.groovy | 128 --
.../facility/shipment/ViewShipment.groovy | 60 -
.../facility/shipment/WeightPackage.groovy | 200 ---
.../facility/storage/StorageServices.groovy | 49 -
.../product/catalog/CatalogServices.groovy | 407 ------
.../category/CategoryContentServices.groovy | 212 ---
.../product/category/CategoryServicesScript.groovy | 798 -----------
.../config/ProductConfigItemContentServices.groovy | 73 -
.../groovyScripts/product/cost/CostServices.groovy | 513 -------
.../feature/ProductFeatureServicesScript.groovy | 81 --
.../ImageManagementServicesScript.groovy | 477 -------
.../inventory/InventoryIssueServices.groovy | 229 ----
.../inventory/InventoryServicesScript.groovy | 176 ---
.../product/price/PriceServicesScript.groovy | 262 ----
.../product/product/ProductContentServices.groovy | 210 ---
.../product/product/ProductServicesScript.groovy | 929 -------------
.../promo/ProductPromoActionServices.groovy | 556 --------
.../product/promo/ProductPromoCondServices.groovy | 599 ---------
.../product/promo/PromoServicesScript.groovy | 44 -
.../product/store/ProductStoreServices.groovy | 452 -------
.../subscription/SubscriptionServicesScript.groovy | 114 --
.../supplier/SupplierProductServicesScript.groovy | 30 -
.../groovyScripts/shipment/IssuanceServices.groovy | 43 -
.../groovyScripts/shipment/PicklistServices.groovy | 39 -
.../shipment/ShipmentReceiptServices.groovy | 495 -------
.../groovyScripts/shipment/ShipmentServices.groovy | 1393 -------------------
.../imagemanagement/ImageManagementEvents.xml | 2 +-
applications/product/servicedef/services.xml | 172 +--
applications/product/servicedef/services_cost.xml | 16 +-
.../product/servicedef/services_facility.xml | 14 +-
.../product/servicedef/services_feature.xml | 6 +-
applications/product/servicedef/services_maint.xml | 20 +-
.../product/servicedef/services_pricepromo.xml | 64 +-
.../product/servicedef/services_shipment.xml | 70 +-
applications/product/servicedef/services_store.xml | 16 +-
.../product/servicedef/services_subscription.xml | 10 +-
.../product/servicedef/services_upgrade.xml | 2 +-
applications/product/servicedef/services_view.xml | 2 +-
.../org/apache/ofbiz/product/CategoryTests.groovy | 68 -
.../org/apache/ofbiz/product/CostTests.groovy | 79 --
.../org/apache/ofbiz/product/InventoryTests.groovy | 54 -
.../apache/ofbiz/product/ProductConfigTests.groovy | 48 -
.../ofbiz/product/ProductFeatureTypeTests.groovy | 44 -
.../apache/ofbiz/product/ProductPriceTests.groovy | 66 -
.../ofbiz/product/ProductPromoActionTests.groovy | 360 -----
.../ofbiz/product/ProductPromoCondTests.groovy | 382 ------
.../org/apache/ofbiz/product/ProductTagTest.groovy | 129 --
.../org/apache/ofbiz/product/ProductTest.groovy | 365 -----
.../org/apache/ofbiz/product/ProductTests.groovy | 48 -
.../org/apache/ofbiz/product/ShipmentTests.groovy | 204 ---
.../ofbiz/product/catalog/ChooseTopCategory.groovy | 27 +
.../ofbiz/product/catalog/FastLoadCache.groovy | 65 +
.../product/catalog/GetSupplierInventories.groovy | 27 +
.../product/catalog/PrepareCreateShipMeth.groovy | 34 +
.../PrepareCreateShipmentTimeEstimate.groovy | 36 +
.../product/catalog/category/CategoryTree.groovy | 87 ++
.../CreateProductInCategoryCheckExisting.groovy | 55 +
.../product/catalog/category/EditCategory.groovy | 131 ++
.../category/EditCategoryContentContent.groovy | 60 +
.../catalog/category/EditCategoryProducts.groovy | 46 +
.../catalog/category/EditCategorySEO.groovy | 45 +
.../config/EditProductConfigItemContent.groovy | 143 ++
.../EditProductConfigItemContentContent.groovy | 70 +
.../feature/EditFeatureCategoryFeatures.groovy | 111 ++
.../catalog/feature/EditFeatureGroups.groovy | 25 +
.../catalog/feature/QuickAddProductFeatures.groovy | 25 +
.../catalog/find/AdvancedSearchOptions.groovy | 67 +
.../product/catalog/find/KeywordSearch.groovy | 57 +
.../product/catalog/find/KeywordSearchBox.groovy | 34 +
.../product/catalog/find/MiniProductList.groovy | 56 +
.../ofbiz/product/catalog/find/SideCatalogs.groovy | 49 +
.../product/catalog/find/SideDeepCategory.groovy | 61 +
.../catalog/imagemanagement/CheckAction.groovy | 42 +
.../catalog/imagemanagement/CheckRejected.groovy | 48 +
.../catalog/imagemanagement/ImageFrame.groovy | 37 +
.../catalog/imagemanagement/ImageGallery.groovy | 50 +
.../imagemanagement/ImageRecentlyApproved.groovy | 97 ++
.../catalog/imagemanagement/ImageUpload.groovy | 160 +++
.../catalog/imagemanagement/SeoLocales.groovy | 76 ++
.../catalog/imagemanagement/SetDefaultImage.groovy | 190 +++
.../catalog/imagemanagement/SortSequenceNum.groovy | 34 +
.../catalog/lookup/LookupVariantProduct.groovy | 77 ++
.../catalog/price/EditProductPriceRules.groovy | 58 +
.../product/ApplyFeaturesFromCategory.groovy | 110 ++
.../catalog/product/ApplyFeaturesFromGroup.groovy | 47 +
.../product/catalog/product/BestProducts.groovy | 107 ++
.../catalog/product/EditProductAssoc.groovy | 49 +
.../catalog/product/EditProductContent.groovy | 179 +++
.../product/EditProductContentContent.groovy | 137 ++
.../catalog/product/EditProductFeatures.groovy | 32 +
.../product/EditProductInventoryItems.groovy | 172 +++
.../catalog/product/EditProductQuickAdmin.groovy | 321 +++++
.../product/catalog/product/EditProductSEO.groovy | 45 +
.../catalog/product/QuickAddVariants.groovy | 27 +
.../catalog/promo/EditProductPromoCode.groovy | 50 +
.../catalog/store/EditProductStorePaySetup.groovy | 91 ++
.../catalog/store/EditProductStoreSurveys.groovy | 42 +
.../catalog/thesaurus/EditKeywordThesaurus.groovy | 73 +
.../facility/ComputeProductSellThroughData.groovy | 44 +
.../CountFacilityInventoryByProduct.groovy | 379 ++++++
.../facility/facility/EditContactMech.groovy | 63 +
.../product/facility/facility/EditFacility.groovy | 51 +
.../facility/facility/EditFacilityLocation.groovy | 56 +
.../facility/facility/FacilityGeoServices.groovy | 43 +
.../facility/FacilityLocationGeoLocation.groovy | 53 +
.../product/facility/facility/FindFacility.groovy | 34 +
.../facility/facility/FindFacilityLocation.groovy | 55 +
.../facility/facility/FindFacilityTransfers.groovy | 67 +
.../facility/FindInventoryItemsByLabels.groovy | 104 ++
.../facility/facility/ViewContactMechs.groovy | 44 +
.../facility/ViewFacilityInventoryByProduct.groovy | 226 ++++
.../inventory/FindFacilityPhysicalInventory.groovy | 75 ++
.../inventory/InventoryAverageCosts.groovy | 50 +
.../facility/inventory/InventoryItemTotals.groovy | 115 ++
.../facility/inventory/LookupInventoryItems.groovy | 54 +
.../inventory/PhysicalInventoryVariance.groovy | 37 +
.../facility/inventory/ReceiveInventory.groovy | 272 ++++
.../inventory/TransferInventoryItem.groovy | 98 ++
.../product/facility/returns/ReceiveReturn.groovy | 92 ++
.../facility/shipment/AddItemsFromInventory.groovy | 61 +
.../facility/shipment/AddItemsFromOrder.groovy | 212 +++
.../product/facility/shipment/EditShipment.groovy | 60 +
.../facility/shipment/EditShipmentItems.groovy | 65 +
.../facility/shipment/EditShipmentPackages.groovy | 56 +
.../facility/shipment/EditShipmentPlan.groovy | 290 ++++
.../shipment/EditShipmentRouteSegments.groovy | 92 ++
.../product/facility/shipment/PackOrder.groovy | 181 +++
.../product/facility/shipment/PackingSlip.groovy | 130 ++
.../facility/shipment/PrintPickSheets.groovy | 136 ++
.../facility/shipment/QuickShipOrder.groovy | 82 ++
.../ReceiveInventoryAgainstPurchaseOrder.groovy | 268 ++++
.../shipment/ReviewOrdersNotPickedOrPacked.groovy | 43 +
.../facility/shipment/ShipmentManifest.groovy | 63 +
.../product/facility/shipment/VerifyPick.groovy | 131 ++
.../product/facility/shipment/ViewShipment.groovy | 63 +
.../product/facility/shipment/WeightPackage.groovy | 203 +++
.../facility/storage/StorageServices.groovy | 49 +
.../product/product/catalog/CatalogServices.groovy | 410 ++++++
.../category/CategoryContentServices.groovy | 215 +++
.../product/category/CategoryServicesScript.groovy | 801 +++++++++++
.../config/ProductConfigItemContentServices.groovy | 76 ++
.../ofbiz/product/product/cost/CostServices.groovy | 516 ++++++++
.../feature/ProductFeatureServicesScript.groovy | 84 ++
.../ImageManagementServicesScript.groovy | 480 +++++++
.../inventory/InventoryIssueServices.groovy | 232 ++++
.../inventory/InventoryServicesScript.groovy | 179 +++
.../product/price/PriceServicesScript.groovy | 265 ++++
.../product/product/ProductContentServices.groovy | 213 +++
.../product/product/ProductServicesScript.groovy | 932 +++++++++++++
.../promo/ProductPromoActionServices.groovy | 559 ++++++++
.../product/promo/ProductPromoCondServices.groovy | 602 +++++++++
.../product/promo/PromoServicesScript.groovy | 44 +
.../product/store/ProductStoreServices.groovy | 455 +++++++
.../subscription/SubscriptionServicesScript.groovy | 117 ++
.../supplier/SupplierProductServicesScript.groovy | 30 +
.../ofbiz/product/shipment/IssuanceServices.groovy | 46 +
.../ofbiz/product/shipment/PicklistServices.groovy | 42 +
.../shipment/ShipmentReceiptServices.groovy | 498 +++++++
.../ofbiz/product/shipment/ShipmentServices.groovy | 1396 ++++++++++++++++++++
.../apache/ofbiz/shipment/ShipmentCostTests.groovy | 380 ------
.../apache/product/product/CategoryTests.groovy | 68 +
.../org/apache/product/product/CostTests.groovy | 79 ++
.../apache/product/product/InventoryTests.groovy | 54 +
.../product/product/ProductConfigTests.groovy | 48 +
.../product/product/ProductFeatureTypeTests.groovy | 44 +
.../product/product/ProductPriceTests.groovy | 66 +
.../product/product/ProductPromoActionTests.groovy | 360 +++++
.../product/product/ProductPromoCondTests.groovy | 382 ++++++
.../apache/product/product/ProductTagTest.groovy | 129 ++
.../org/apache/product/product/ProductTest.groovy | 365 +++++
.../org/apache/product/product/ProductTests.groovy | 48 +
.../apache/product/product/ShipmentTests.groovy | 204 +++
.../product/shipment/ShipmentCostTests.groovy | 380 ++++++
.../product/webapp/catalog/WEB-INF/controller.xml | 8 +-
.../product/widget/catalog/CategoryScreens.xml | 12 +-
.../product/widget/catalog/CommonScreens.xml | 12 +-
.../product/widget/catalog/ConfigScreens.xml | 4 +-
.../product/widget/catalog/FeatureScreens.xml | 6 +-
.../product/widget/catalog/FindScreens.xml | 4 +-
.../widget/catalog/ImageManagementForms.xml | 2 +-
.../widget/catalog/ImageManagementScreens.xml | 8 +-
.../product/widget/catalog/LookupScreens.xml | 2 +-
.../product/widget/catalog/PriceScreens.xml | 2 +-
.../product/widget/catalog/ProductScreens.xml | 24 +-
.../product/widget/catalog/PromoScreens.xml | 2 +-
.../product/widget/catalog/StoreScreens.xml | 4 +-
.../product/widget/catalog/ThesaurusScreens.xml | 2 +-
.../product/widget/facility/FacilityForms.xml | 2 +-
.../product/widget/facility/FacilityScreens.xml | 50 +-
.../product/widget/facility/LookupScreens.xml | 4 +-
.../product/widget/facility/ReportScreens.xml | 2 +-
.../product/widget/facility/ShipmentScreens.xml | 46 +-
.../groovyScripts/ical/IsCalOwner.groovy | 29 -
.../workeffort/calendar/CreateUrlParam.groovy | 33 -
.../groovyScripts/workeffort/calendar/Days.groovy | 49 -
.../groovyScripts/workeffort/calendar/Month.groovy | 75 --
.../workeffort/calendar/Upcoming.groovy | 49 -
.../groovyScripts/workeffort/calendar/Week.groovy | 51 -
.../content/WorkEffortContentWrapperScript.groovy | 30 -
.../workeffort/find/WorkEffortSearchOptions.groovy | 60 -
.../workeffort/find/WorkEffortSearchResults.groovy | 34 -
.../workeffort/request/RequestList.groovy | 22 -
.../workeffort/WorkEffortServicesScript.groovy | 175 ---
applications/workeffort/servicedef/services.xml | 4 +-
.../apache/ofbiz/workeffort/ical/IsCalOwner.groovy | 32 +
.../workeffort/calendar/CreateUrlParam.groovy | 36 +
.../workeffort/workeffort/calendar/Days.groovy | 52 +
.../workeffort/workeffort/calendar/Month.groovy | 78 ++
.../workeffort/workeffort/calendar/Upcoming.groovy | 52 +
.../workeffort/workeffort/calendar/Week.groovy | 54 +
.../content/WorkEffortContentWrapperScript.groovy | 33 +
.../workeffort/find/WorkEffortSearchOptions.groovy | 63 +
.../workeffort/find/WorkEffortSearchResults.groovy | 37 +
.../workeffort/request/RequestList.groovy | 25 +
.../workeffort/WorkEffortServicesScript.groovy | 178 +++
applications/workeffort/widget/CalendarScreens.xml | 14 +-
applications/workeffort/widget/CommonScreens.xml | 2 +-
.../workeffort/widget/CustRequestScreens.xml | 2 +-
.../workeffort/widget/WorkEffortScreens.xml | 4 +-
.../base/groovyScripts/test/SimpleTests.groovy | 42 -
.../org/apache/ofbizbase/test/SimpleTests.groovy | 45 +
framework/base/testdef/basetests.xml | 2 +-
framework/common/groovyScripts/CcTypes.groovy | 23 -
framework/common/groovyScripts/CertKeystore.groovy | 46 -
.../groovyScripts/ChildrenCustomScreenTypes.groovy | 33 -
.../common/groovyScripts/CommonServices.groovy | 445 -------
.../groovyScripts/FindAutocompleteOptions.groovy | 162 ---
framework/common/groovyScripts/GeoLocation.groovy | 23 -
.../common/groovyScripts/GetLocaleList.groovy | 38 -
.../groovyScripts/GetParentPortalPageId.groovy | 71 -
.../common/groovyScripts/GroovyServiceTest.groovy | 68 -
framework/common/groovyScripts/InitTheme.groovy | 46 -
.../common/groovyScripts/ListPortalPortlets.groovy | 49 -
.../groovyScripts/PrepareDataForFlotGraph.groovy | 53 -
.../groovyScripts/SetTimeZoneFromBrowser.groovy | 33 -
.../groovyScripts/email/EmailServices.groovy | 79 --
.../permission/CommonPermissionServices.groovy | 112 --
framework/common/servicedef/services.xml | 42 +-
framework/common/servicedef/services_email.xml | 2 +-
framework/common/servicedef/services_test.xml | 8 +-
.../groovy/org/apache/ofbiz/common/CcTypes.groovy | 26 +
.../org/apache/ofbiz/common/CertKeystore.groovy | 49 +
.../ofbiz/common/ChildrenCustomScreenTypes.groovy | 36 +
.../org/apache/ofbiz/common/CommonServices.groovy | 448 +++++++
.../ofbiz/common/FindAutocompleteOptions.groovy | 165 +++
.../org/apache/ofbiz/common/GeoLocation.groovy | 26 +
.../org/apache/ofbiz/common/GetLocaleList.groovy | 41 +
.../ofbiz/common/GetParentPortalPageId.groovy | 74 ++
.../org/apache/ofbiz/common/InitTheme.groovy | 49 +
.../apache/ofbiz/common/ListPortalPortlets.groovy | 52 +
.../ofbiz/common/PrepareDataForFlotGraph.groovy | 56 +
.../ofbiz/common/SetTimeZoneFromBrowser.groovy | 36 +
.../apache/ofbiz/common/email/EmailServices.groovy | 82 ++
.../permission/CommonPermissionServices.groovy | 115 ++
.../apache/ofbizcommon/GroovyServiceTest.groovy | 71 +
framework/common/widget/CommonScreens.xml | 4 +-
framework/common/widget/LookupScreens.xml | 6 +-
framework/common/widget/PortalPageScreens.xml | 2 +-
framework/common/widget/SecurityScreens.xml | 2 +-
framework/common/widget/flotScreens.xml | 2 +-
.../groovyScripts/EntitySyncServices.groovy | 33 -
framework/entityext/servicedef/services.xml | 4 +-
.../ofbiz/entityext/EntitySyncServices.groovy | 36 +
.../service/groovyScripts/test/TestServices.groovy | 42 -
framework/service/servicedef/services_test_se.xml | 8 +-
.../ofbiz/service/test/ServicePurgeTest.groovy | 57 -
.../apache/ofbizservice/test/TestServices.groovy | 45 +
.../service/service/test/ServicePurgeTest.groovy | 57 +
framework/service/testdef/servicetests.xml | 2 +-
.../groovyScripts/artifactinfo/ArtifactInfo.groovy | 68 -
.../artifactinfo/ComponentList.groovy | 71 -
.../artifactinfo/TestSuiteInfo.groovy | 48 -
.../artifactinfo/TestSuiteResults.groovy | 67 -
.../groovyScripts/cache/EditUtilCache.groovy | 56 -
.../groovyScripts/cache/FindUtilCache.groovy | 65 -
.../cache/FindUtilCacheElements.groovy | 52 -
.../groovyScripts/datafile/ViewDataFile.groovy | 104 --
.../webtools/groovyScripts/entity/CheckDb.groovy | 133 --
.../groovyScripts/entity/EntityMaint.groovy | 102 --
.../entity/EntityPerformanceTest.groovy | 246 ----
.../webtools/groovyScripts/entity/EntityRef.groovy | 39 -
.../groovyScripts/entity/EntityRefList.groovy | 50 -
.../groovyScripts/entity/EntitySQLProcessor.groovy | 83 --
.../groovyScripts/entity/FindGeneric.groovy | 168 ---
.../groovyScripts/entity/ModelInduceFromDb.groovy | 20 -
.../groovyScripts/entity/ProgramExport.groovy | 106 --
.../groovyScripts/entity/ViewGeneric.groovy | 259 ----
.../groovyScripts/entity/ViewRelations.groovy | 50 -
.../webtools/groovyScripts/entity/XmlDsDump.groovy | 346 -----
.../groovyScripts/geo/GetGeoLocation.groovy | 22 -
.../groovyScripts/labelmanager/LabelManager.groovy | 43 -
.../labelmanager/UpdateManager.groovy | 32 -
.../groovyScripts/labelmanager/ViewFile.groovy | 39 -
.../labelmanager/ViewReferences.groovy | 37 -
.../groovyScripts/log/LogConfiguration.groovy | 28 -
.../groovyScripts/service/AvailableServices.groovy | 578 --------
.../groovyScripts/service/JobDetails.groovy | 38 -
.../groovyScripts/service/ScheduleJob.groovy | 66 -
.../groovyScripts/service/ServiceResult.groovy | 47 -
.../webtools/groovyScripts/service/Services.groovy | 45 -
.../webtools/groovyScripts/service/Threads.groovy | 51 -
.../groovyScripts/stats/StatBinsHistory.groovy | 66 -
.../groovyScripts/stats/StatsSinceStart.groovy | 81 --
.../webtools/artifactinfo/ArtifactInfo.groovy | 71 +
.../webtools/artifactinfo/ComponentList.groovy | 74 ++
.../ofbiz/webtools/cache/EditUtilCache.groovy | 59 +
.../ofbiz/webtools/cache/FindUtilCache.groovy | 68 +
.../webtools/cache/FindUtilCacheElements.groovy | 55 +
.../ofbiz/webtools/datafile/ViewDataFile.groovy | 107 ++
.../apache/ofbiz/webtools/entity/CheckDb.groovy | 136 ++
.../ofbiz/webtools/entity/EntityMaint.groovy | 105 ++
.../apache/ofbiz/webtools/entity/EntityRef.groovy | 42 +
.../ofbiz/webtools/entity/EntityRefList.groovy | 53 +
.../webtools/entity/EntitySQLProcessor.groovy | 86 ++
.../ofbiz/webtools/entity/FindGeneric.groovy | 171 +++
.../ofbiz/webtools/entity/ModelInduceFromDb.groovy | 23 +
.../ofbiz/webtools/entity/ProgramExport.groovy | 109 ++
.../ofbiz/webtools/entity/ViewGeneric.groovy | 262 ++++
.../ofbiz/webtools/entity/ViewRelations.groovy | 53 +
.../apache/ofbiz/webtools/entity/XmlDsDump.groovy | 349 +++++
.../ofbiz/webtools/geo/GetGeoLocation.groovy | 25 +
.../webtools/labelmanager/LabelManager.groovy | 46 +
.../webtools/labelmanager/UpdateManager.groovy | 35 +
.../ofbiz/webtools/labelmanager/ViewFile.groovy | 42 +
.../webtools/labelmanager/ViewReferences.groovy | 40 +
.../ofbiz/webtools/log/LogConfiguration.groovy | 31 +
.../webtools/service/AvailableServices.groovy | 581 ++++++++
.../ofbiz/webtools/service/JobDetails.groovy | 41 +
.../ofbiz/webtools/service/ScheduleJob.groovy | 69 +
.../ofbiz/webtools/service/ServiceResult.groovy | 50 +
.../apache/ofbiz/webtools/service/Services.groovy | 48 +
.../apache/ofbiz/webtools/service/Threads.groovy | 54 +
.../ofbiz/webtools/stats/StatBinsHistory.groovy | 69 +
.../ofbiz/webtools/stats/StatsSinceStart.groovy | 84 ++
.../artifactinfo/TestSuiteInfo.groovy | 51 +
.../artifactinfo/TestSuiteResults.groovy | 70 +
.../entity/EntityPerformanceTest.groovy | 249 ++++
framework/webtools/widget/ArtifactInfoScreens.xml | 8 +-
framework/webtools/widget/CacheScreens.xml | 6 +-
framework/webtools/widget/EntityScreens.xml | 24 +-
framework/webtools/widget/GeoManagementScreens.xml | 2 +-
framework/webtools/widget/LabelManagerScreens.xml | 8 +-
framework/webtools/widget/LogScreens.xml | 4 +-
framework/webtools/widget/MiscScreens.xml | 2 +-
framework/webtools/widget/ServiceScreens.xml | 16 +-
framework/webtools/widget/StatsScreens.xml | 4 +-
themes/common-theme/widget/CommonScreens.xml | 2 +-
1057 files changed, 56572 insertions(+), 55363 deletions(-)
diff --git a/applications/accounting/groovyScripts/admin/AcctgAdminServices.groovy b/applications/accounting/groovyScripts/admin/AcctgAdminServices.groovy
deleted file mode 100644
index 1402d0c7c7..0000000000
--- a/applications/accounting/groovyScripts/admin/AcctgAdminServices.groovy
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Timestamp
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilProperties
-import org.apache.ofbiz.entity.condition.EntityConditionBuilder
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.entity.util.EntityUtil
-import org.apache.ofbiz.service.ModelService
-
-Map createPartyAcctgPreference() {
- //check that the party is an INTERNAL_ORGANIZATION, as defined in PartyRole
- partyRole = select().from('PartyRole').where([partyId: parameters.partyId, roleTypeId: 'INTERNAL_ORGANIZATIO']).queryOne()
- if (!partyRole) {
- String errorMessage = UtilProperties.getMessage('AccountingUiLabels', 'AccountingPartyMustBeInternalOrganization', locale)
- logError(errorMessage)
- return error(errorMessage)
- }
- //Does not check if the Party is actually a company because real people have to pay taxes too
-
- //TODO: maybe check to make sure that all fields are not null
- newEntity = delegator.makeValidValue('PartyAcctgPreference', parameters)
- delegator.create(newEntity)
- return success()
-}
-
-Map getPartyAccountingPreferences() {
- Map result = success()
- GenericValue aggregatedPartyAcctgPref = delegator.makeValidValue('PartyAcctgPreference', parameters)
- String currentOrganizationPartyId = parameters.organizationPartyId
- Boolean containsEmptyFields = true
-
- while (currentOrganizationPartyId && containsEmptyFields) {
- GenericValue currentPartyAcctgPref = select().from('PartyAcctgPreference').where([partyId: currentOrganizationPartyId]).queryOne()
- containsEmptyFields = false
- if (currentPartyAcctgPref) {
- for (String entityKey : currentPartyAcctgPref.keySet()) {
- Object entityValue = currentPartyAcctgPref.get(entityKey)
- if (entityValue) {
- aggregatedPartyAcctgPref.put(entityKey, entityValue)
- } else {
- containsEmptyFields = true
- }
- }
- } else {
- containsEmptyFields = true
- }
- List<GenericValue> parentPartyRelationships = select().from('PartyRelationship')
- .where([partyIdTo: currentOrganizationPartyId, partyRelationshipTypeId: 'GROUP_ROLLUP', roleTypeIdFrom: '_NA_',
- roleTypeIdTo: '_NA_'])
- .filterByDate().queryList()
- if (parentPartyRelationships) {
- GenericValue parentPartyRelationship = EntityUtil.getFirst(parentPartyRelationships)
- currentOrganizationPartyId = parentPartyRelationship.partyIdFrom
- } else {
- currentOrganizationPartyId = null
- }
- }
-
- if (aggregatedPartyAcctgPref) {
- aggregatedPartyAcctgPref.put('partyId', parameters.organizationPartyId)
- result.put('partyAccountingPreference', aggregatedPartyAcctgPref)
- }
- return result
-}
-
-Map setAcctgCompany() {
- Map result = success()
- //Set user preference
- GenericValue partyAcctgPreference = select().from('PartyAcctgPreference').where([partyId: parameters.organizationPartyId]).queryOne()
- if (partyAcctgPreference) {
- result = runService('setUserPreference',
- [userPrefValue: parameters.organizationPartyId, userPrefGroupTypeId: 'GLOBAL_PREFERENCES', userPrefTypeId: 'ORGANIZATION_PARTY'])
- }
- result.put('organizationPartyId', parameters.organizationPartyId)
-
- return result
-}
-
-Map updateFXConversion() {
- //Set the FX rate changes as of now
- Timestamp nowTimestamp = parameters.asOfTimestamp ?: UtilDateTime.nowTimestamp()
-
- //find the existing exchange rates for this currency pair
- exprBldr = new EntityConditionBuilder()
- condition = exprBldr.AND {
- EQUALS(uomId: parameters.uomId)
- EQUALS(uomIdTo: parameters.uomIdTo)
- }
- if (parameters.purposeEnumId) {
- condition = exprBldr.AND(condition) {
- EQUALS(purposeEnumId: parameters.purposeEnumId)
- }
- }
- List<GenericValue> uomConversions = select().from('UomConversionDated').where(condition).orderBy('-fromDate').filterByDate().queryList()
-
- //expire all of them
- for (GenericValue uomConversion : uomConversions) {
- if (parameters.fromDate) {
- uomConversion.put('thruDate', parameters.fromDate)
- } else {
- uomConversion.put('thruDate', nowTimestamp)
- }
- }
- delegator.storeAll(uomConversions)
-
- //now create a new conversion relationship
- Map createParams = dispatcher.getDispatchContext().makeValidContext('createUomConversionDated', ModelService.IN_PARAM, parameters)
- if (!parameters.fromDate) {
- createParams.put('fromDate', nowTimestamp)
- }
- result = runService('createUomConversionDated', createParams)
-
- return success()
-}
-
-Map getFXConversion() {
- Map result = success()
- Timestamp asOfTimestamp = parameters.asOfTimestamp ?: UtilDateTime.nowTimestamp()
-
- //find the existing exchange rates
- exprBldr = new EntityConditionBuilder()
- thruDateCondition = exprBldr.OR {
- EQUALS(thruDate: null)
- GREATER_THAN_EQUAL_TO(thruDate: asOfTimestamp)
- }
- condition = exprBldr.AND(thruDateCondition) {
- EQUALS(uomId: parameters.uomId)
- EQUALS(uomIdTo: parameters.uomIdTo)
- LESS_THAN_EQUAL_TO(fromDate: asOfTimestamp)
- }
- if (parameters.purposeEnumId) {
- condition = exprBldr.AND(condition) {
- EQUALS(purposeEnumId: parameters.purposeEnumId)
- }
- }
- List<GenericValue> rates = select().from('UomConversionDated').where(condition).orderBy('-fromDate').filterByDate().queryList()
-
- BigDecimal conversionRate
- int decimalScale = 2
- int roundingMode = BigDecimal.ROUND_HALF_UP
- if (rates) {
- conversionFactor = EntityUtil.getFirst(rates).getBigDecimal('conversionFactor')
- BigDecimal originalValue = BigDecimal.ONE
- conversionRate = originalValue.divide(conversionFactor, decimalScale, roundingMode)
- } else {
- String errorMessage = 'Could not find conversion rate'
- logError(errorMessage)
- return error(errorMessage)
- }
- result.put('conversionRate', conversionRate)
- return result
-}
diff --git a/applications/accounting/groovyScripts/admin/FilterOutReceipts.groovy b/applications/accounting/groovyScripts/admin/FilterOutReceipts.groovy
deleted file mode 100644
index 655939b798..0000000000
--- a/applications/accounting/groovyScripts/admin/FilterOutReceipts.groovy
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- // simple script to filter out receipts in a list of payments
-
-import org.apache.ofbiz.accounting.util.UtilAccounting
-
-context.payments.removeAll { UtilAccounting.isReceipt(it) }
diff --git a/applications/accounting/groovyScripts/admin/ListInvoiceItemTypesGlAccount.groovy b/applications/accounting/groovyScripts/admin/ListInvoiceItemTypesGlAccount.groovy
deleted file mode 100644
index e072696f74..0000000000
--- a/applications/accounting/groovyScripts/admin/ListInvoiceItemTypesGlAccount.groovy
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.entity.condition.EntityConditionBuilder
-
-// Optional prefix parameter to filter InvoiceItemTypes by (i.e. "INV" or "PINV") defaults to INV
-invItemTypePrefix = context.invItemTypePrefix ?: 'INV'
-invItemTypePrefix += '_%'
-
-organizationPartyId = parameters.organizationPartyId
-exprBldr = new EntityConditionBuilder()
-invoiceItemTypes = from('InvoiceItemType').where(exprBldr.LIKE(invoiceItemTypeId: invItemTypePrefix)).queryList()
-
-context.invoiceItemTypes = invoiceItemTypes.collect { invoiceItemType ->
- defaultAccount = true
- glAccount = null
- invoiceItemTypeOrgs = invoiceItemType.getRelated('InvoiceItemTypeGlAccount', [organizationPartyId: organizationPartyId], null, false)
- overrideGlAccountId = null
- if (invoiceItemTypeOrgs) {
- invoiceItemTypeOrg = invoiceItemTypeOrgs[0]
- overrideGlAccountId = invoiceItemTypeOrg.glAccountId
-
- glAccounts = invoiceItemTypeOrg.getRelated('GlAccount', null, null, false)
- if (glAccounts) {
- glAccount = glAccounts[0]
- defaultAccount = false
- }
- } else {
- glAccount = invoiceItemType.getRelatedOne('DefaultGlAccount', false)
- }
-
- return [invoiceItemTypeId: invoiceItemType.invoiceItemTypeId,
- description: invoiceItemType.description,
- defaultGlAccountId: invoiceItemType.defaultGlAccountId,
- overrideGlAccountId: overrideGlAccountId,
- defaultAccount: defaultAccount,
- activeGlDescription: glAccount?.accountName]
-}
diff --git a/applications/accounting/groovyScripts/agreement/AgreementServices.groovy b/applications/accounting/groovyScripts/agreement/AgreementServices.groovy
deleted file mode 100644
index 45644ff121..0000000000
--- a/applications/accounting/groovyScripts/agreement/AgreementServices.groovy
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.service.ModelService
-import org.apache.ofbiz.service.ServiceUtil
-
-/**
- * Copy an existing Agreement
- */
-
-Map copyAgreement() {
- agreement = from('Agreement').where('agreementId', parameters.agreementId).queryOne()
- serviceResult = success()
- if (agreement) {
- Map createAgreementInMap = dispatcher.getDispatchContext().makeValidContext('createAgreement', ModelService.IN_PARAM, agreement)
- result = run service: 'createAgreement', with: createAgreementInMap
- if (ServiceUtil.isError(result)) {
- return result
- }
- agreementIdTo = result.agreementId
- agreementItems = agreement.getRelated('AgreementItem', null, null, false)
- agreementItems.each { agreementItem ->
- Map createAgreementItemInMap = dispatcher.getDispatchContext().makeValidContext('createAgreementItem',
- ModelService.IN_PARAM, agreementItem)
- createAgreementItemInMap.agreementId = agreementIdTo
- result = run service: 'createAgreementItem', with: createAgreementItemInMap
- }
- if (parameters.copyAgreementTerms == 'Y') {
- agreementTerms = agreement.getRelated('AgreementTerm', null, null, false)
- agreementTerms.each { agreementTerm ->
- Map createAgreementTermInMap = dispatcher.getDispatchContext().makeValidContext('createAgreementTerm',
- ModelService.IN_PARAM, agreementTerm)
- createAgreementTermInMap.agreementId = agreementIdTo
- createAgreementTermInMap.remove('agreementTermId')
- result = run service: 'createAgreementTerm', with: createAgreementTermInMap
- }
- }
- if (parameters.copyAgreementProducts == 'Y') {
- agreementProductAppls = agreement.getRelated('AgreementProductAppl', null, null, false)
- agreementProductAppls.each { agreementProductAppl ->
- Map createAgreementProductApplInMap = dispatcher.getDispatchContext().makeValidContext('createAgreementProductAppl',
- ModelService.IN_PARAM, agreementProductAppl)
- createAgreementProductApplInMap.agreementId = agreementIdTo
- result = run service: 'createAgreementProductAppl', with: createAgreementProductApplInMap
- }
- }
- if (parameters.copyAgreementFacilities == 'Y') {
- agreementFacilityAppls = agreement.getRelated('AgreementFacilityAppl', null, null, false)
- agreementFacilityAppls.each { agreementFacilityAppl ->
- Map createAgreementFacilityApplInMap = dispatcher.getDispatchContext().makeValidContext('createAgreementFacilityAppl',
- ModelService.IN_PARAM, agreementFacilityAppl)
- createAgreementFacilityApplInMap.agreementId = agreementIdTo
- result = run service: 'createAgreementFacilityAppl', with: createAgreementFacilityApplInMap
- }
- }
- if (parameters.copyAgreementParties == 'Y') {
- agreementPartyApplics = agreement.getRelated('AgreementPartyApplic', null, null, false)
- agreementPartyApplics.each { agreementPartyApplic ->
- Map createAgreementPartyApplicInMap = dispatcher.getDispatchContext().makeValidContext('createAgreementPartyApplic',
- ModelService.IN_PARAM, agreementPartyApplic)
- createAgreementPartyApplicInMap.agreementId = agreementIdTo
- result = run service: 'createAgreementPartyApplic', with: createAgreementPartyApplicInMap
- }
- }
- serviceResult.agreementId = agreementIdTo
- }
- return serviceResult
-}
diff --git a/applications/accounting/groovyScripts/agreement/GetPartyNameForDate.groovy b/applications/accounting/groovyScripts/agreement/GetPartyNameForDate.groovy
deleted file mode 100644
index 12232c0dd7..0000000000
--- a/applications/accounting/groovyScripts/agreement/GetPartyNameForDate.groovy
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-if (partyIdFrom) {
- context.partyNameResultFrom = runService('getPartyNameForDate', [partyId: partyIdFrom, compareDate: agreementDate, lastNameFirst: 'Y'])
-}
-if (partyIdTo) {
- context.partyNameResultTo = runService('getPartyNameForDate', [partyId: partyIdTo, compareDate: agreementDate, lastNameFirst: 'Y'])
-}
diff --git a/applications/accounting/groovyScripts/ap/invoices/CommissionReport.groovy b/applications/accounting/groovyScripts/ap/invoices/CommissionReport.groovy
deleted file mode 100644
index 742449aca3..0000000000
--- a/applications/accounting/groovyScripts/ap/invoices/CommissionReport.groovy
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-import org.apache.ofbiz.entity.util.EntityUtil
-
-import java.sql.Timestamp
-
-if (parameters.isSearch == 'Y') {
- fromDate = parameters.fromDate
- thruDate = parameters.thruDate
- partyId = parameters.partyId
- productId = parameters.productId
- invoiceItemAndAssocProductCond = []
- if (productId) {
- invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition('productId', EntityOperator.EQUALS, productId))
- }
- if (partyId) {
- invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition('partyIdFrom', EntityOperator.EQUALS, partyId))
- }
- if (fromDate) {
- invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition('fromDate',
- EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate)))
- }
- if (thruDate) {
- invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition('thruDate', EntityOperator.LESS_THAN_EQUAL_TO, Timestamp.valueOf(thruDate)))
- }
- invoiceItemAndAssocProductList = []
- invoiceItemAndAssocProductList = from('InvoiceItemAndAssocProduct').where(invoiceItemAndAssocProductCond).queryList()
-
- //filtering invoiceItemAndAssocProductList for each productId with updating quantity,
- // commission amount and number of order which generated sales invoices.
- totalQuantity = BigDecimal.ZERO
- totalNumberOfOrders = BigDecimal.ZERO
- totalCommissionAmount = BigDecimal.ZERO
- totalNetSales = BigDecimal.ZERO
- commissionReportList = []
- if (invoiceItemAndAssocProductList) {
- productIds = EntityUtil.getFieldListFromEntityList(invoiceItemAndAssocProductList, 'productId', true)
- productIds.each { productId ->
- quantity = BigDecimal.ZERO
- commissionAmount = BigDecimal.ZERO
- termAmount = BigDecimal.ZERO
- invoiceItemProductAmount = BigDecimal.ZERO
- assocProductId = null
- productName = null
- commissionReportMap = [:]
- salesAgentAndTermAmtMap = [:]
- salesInvoiceIds = []
- invoiceItemAndAssocProductList.each { invoiceItemAndAssocProduct ->
- if (productId == invoiceItemAndAssocProduct.productId) {
- partyIdTermAmountMap = [:]
- partyIdTermAmountKey = null
- assocProductId = invoiceItemAndAssocProduct.productId
- productName = invoiceItemAndAssocProduct.productName
- quantity = quantity.add(invoiceItemAndAssocProduct.quantity)
- commissionAmount = commissionAmount.add(invoiceItemAndAssocProduct.termAmount * invoiceItemAndAssocProduct.quantity)
- termAmount = termAmount.add(invoiceItemAndAssocProduct.termAmount)
- partyIdTermAmountMap.partyId = invoiceItemAndAssocProduct.partyIdFrom
- partyIdTermAmountMap.termAmount = invoiceItemAndAssocProduct.termAmount
- partyIdTermAmountKey = invoiceItemAndAssocProduct.partyIdFrom + invoiceItemAndAssocProduct.termAmount
- if (!salesAgentAndTermAmtMap.containsKey(partyIdTermAmountKey)) {
- salesAgentAndTermAmtMap.put(partyIdTermAmountKey, partyIdTermAmountMap)
- }
- salesInvoiceIds.add(invoiceItemAndAssocProduct.invoiceIdFrom)
- invoiceItemProductAmount = invoiceItemAndAssocProduct.amount
- }
- }
- commissionReportMap.productId = assocProductId
- commissionReportMap.productName = productName
- commissionReportMap.quantity = quantity
- commissionReportMap.salesAgentAndTermAmtMap = salesAgentAndTermAmtMap
- commissionReportMap.commissionAmount = commissionAmount
- commissionReportMap.netSale = invoiceItemProductAmount * quantity
- commissionReportMap.salesInvoiceIds = salesInvoiceIds
- commissionReportMap.numberOfOrders = salesInvoiceIds.size()
- commissionReportList.add(commissionReportMap)
- totalQuantity = totalQuantity.add(quantity)
- totalNumberOfOrders = totalNumberOfOrders.add(salesInvoiceIds.size())
- totalCommissionAmount = totalCommissionAmount.add(commissionAmount)
- totalNetSales = totalNetSales.add(invoiceItemProductAmount * quantity)
- }
- }
- context.commissionReportList = commissionReportList
- context.totalQuantity = totalQuantity
- context.totalNumberOfOrders = totalNumberOfOrders
- context.totalCommissionAmount = totalCommissionAmount
- context.totalNetSales = totalNetSales
-}
diff --git a/applications/accounting/groovyScripts/ap/invoices/CommissionRun.groovy b/applications/accounting/groovyScripts/ap/invoices/CommissionRun.groovy
deleted file mode 100644
index b0cccdc3cb..0000000000
--- a/applications/accounting/groovyScripts/ap/invoices/CommissionRun.groovy
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Timestamp
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-
-fromDate = parameters.fromDate
-thruDate = parameters.thruDate
-
-if (fromDate) {
- List invoiceCond = []
- invoiceCond.add(EntityCondition.makeCondition('invoiceTypeId', EntityOperator.EQUALS, parameters.invoiceTypeId))
- invoiceCond.add(EntityCondition.makeCondition('statusId', EntityOperator.EQUALS, parameters.statusId))
- invoiceCond.add(EntityCondition.makeCondition('invoiceDate', EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate)))
- invoiceCond.add(EntityCondition.makeCondition('invoiceRoleTypeId', EntityOperator.EQUALS, 'SALES_REP'))
- if (thruDate) {
- invoiceCond.add(EntityCondition.makeCondition('invoiceDate', EntityOperator.LESS_THAN_EQUAL_TO, Timestamp.valueOf(thruDate)))
- }
- if (context.salesRepPartyList) {
- invoiceCond.add(EntityCondition.makeCondition('invoiceRolePartyId', EntityOperator.IN, context.salesRepPartyList))
- }
- invoiceList = from('InvoiceAndRole').where(invoiceCond).queryList()
-
- List invoices = []
- if (invoiceList) {
- resultMap = runService('getInvoicesFilterByAssocType',
- [invoiceItemAssocTypeId: 'COMMISSION_INVOICE', invoiceList: invoiceList, userLogin: userLogin])
- invoices = resultMap.filteredInvoiceList
- context.invoices = invoices
- }
-}
diff --git a/applications/accounting/groovyScripts/ar/BatchPayments.groovy b/applications/accounting/groovyScripts/ar/BatchPayments.groovy
deleted file mode 100644
index db1d6c8eb1..0000000000
--- a/applications/accounting/groovyScripts/ar/BatchPayments.groovy
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.accounting.util.UtilAccounting
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-import org.apache.ofbiz.entity.util.EntityUtil
-
-if (parameters.noConditionFind == 'Y') {
- List paymentCond = []
- payments = []
- finAccountId = parameters.finAccountId
- context.finAccountId = parameters.finAccountId
- paymentStatusCond = EntityCondition.makeCondition([EntityCondition.makeCondition('statusId', EntityOperator.EQUALS, 'PMNT_RECEIVED'),
- EntityCondition.makeCondition('statusId', EntityOperator.EQUALS, 'PMNT_SENT')], EntityOperator.OR)
- paymentCond.add(paymentStatusCond)
- if (paymentMethodTypeId) {
- paymentCond.add(EntityCondition.makeCondition('paymentMethodTypeId', EntityOperator.EQUALS, paymentMethodTypeId))
- }
- if (fromDate) {
- paymentCond.add(EntityCondition.makeCondition('effectiveDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
- }
- if (thruDate) {
- paymentCond.add(EntityCondition.makeCondition('effectiveDate', EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
- }
- if (partyIdFrom) {
- paymentCond.add(EntityCondition.makeCondition('partyIdFrom', EntityOperator.EQUALS, partyIdFrom))
- }
- if (finAccountId) {
- finAccountTransList = from('FinAccountTrans').where('finAccountId', finAccountId).queryList()
- if (finAccountTransList) {
- finAccountTransIds = EntityUtil.getFieldListFromEntityList(finAccountTransList, 'finAccountTransId', true)
- paymentCond.add(EntityCondition.makeCondition('finAccountTransId', EntityOperator.IN, finAccountTransIds))
- payments = from('PaymentAndTypePartyNameView').where(paymentCond).queryList()
- }
- } else {
- paymentCond.add(EntityCondition.makeCondition('finAccountTransId', EntityOperator.EQUALS, null))
- payments = from('PaymentAndTypePartyNameView').where(paymentCond).queryList()
- }
- paymentListWithCreditCard = []
- paymentListWithoutCreditCard = []
- if (payments) {
- payments.each { payment ->
- isReceipt = UtilAccounting.isReceipt(payment)
- if (isReceipt) {
- paymentGroupMembers = from('PaymentGroupMember').where('paymentId', payment.paymentId).filterByDate().queryList()
- if (!paymentGroupMembers) {
- if (cardType && payment.paymentMethodId) {
- creditCard = from('CreditCard').where('paymentMethodId', payment.paymentMethodId).queryOne()
- if (creditCard.cardType == cardType) {
- paymentListWithCreditCard.add(payment)
- }
- } else if (!cardType) {
- paymentListWithoutCreditCard.add(payment)
- }
- }
- }
- }
- if (paymentListWithCreditCard) {
- context.paymentList = paymentListWithCreditCard
- } else {
- context.paymentList = paymentListWithoutCreditCard
- }
- }
-}
diff --git a/applications/accounting/groovyScripts/budget/BudgetServices.groovy b/applications/accounting/groovyScripts/budget/BudgetServices.groovy
deleted file mode 100644
index 313c1c6816..0000000000
--- a/applications/accounting/groovyScripts/budget/BudgetServices.groovy
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.entity.GenericValue
-
-Map updateBudgetStatus() {
- Map result = success()
- List budgetStatuses = from('BudgetStatus').where([budgetId: parameters.budgetId]).orderBy('-statusDate').queryList()
- GenericValue statusValidChange = null
- if (budgetStatuses) {
- budgetStatus = budgetStatuses[0]
- statusValidChange = from('StatusValidChange').where([statusId: budgetStatus.statusId, statusIdTo: parameters.statusId]).queryOne()
- }
- if (! budgetStatuses || budgetStatuses && statusValidChange) {
- result = run service: 'createBudgetStatus', with: parameters
- }
- return result
-}
diff --git a/applications/accounting/groovyScripts/chartofaccounts/TaxAuthorityGlAccounts.groovy b/applications/accounting/groovyScripts/chartofaccounts/TaxAuthorityGlAccounts.groovy
deleted file mode 100644
index 6013b0bd6a..0000000000
--- a/applications/accounting/groovyScripts/chartofaccounts/TaxAuthorityGlAccounts.groovy
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-taxAuthorities = from('TaxAuthority').orderBy('taxAuthGeoId', 'taxAuthPartyId').queryList()
-
-context.taxAuthorityHavingNoGlAccountList = taxAuthorities.findAll { taxAuthority ->
- !taxAuthority.getRelated('TaxAuthorityGlAccount', [organizationPartyId: parameters.get('ApplicationDecorator|organizationPartyId')], null, false)
-}
diff --git a/applications/accounting/groovyScripts/fixedasset/FixedAssetGeoLocation.groovy b/applications/accounting/groovyScripts/fixedasset/FixedAssetGeoLocation.groovy
deleted file mode 100644
index 61cace5c57..0000000000
--- a/applications/accounting/groovyScripts/fixedasset/FixedAssetGeoLocation.groovy
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.base.util.UtilProperties
-import org.apache.ofbiz.common.geo.GeoWorker
-
-uiLabelMap = UtilProperties.getResourceBundleMap('AccountingUiLabels', locale)
-
-if (fixedAsset) {
- latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, 'FixedAssetAndGeoPoint', 'fixedAssetId', fixedAssetId, null, null)
- if (latestGeoPoint) {
- context.latestGeoPoint = latestGeoPoint
- if (latestGeoPoint.containsKey('latitude') && latestGeoPoint.containsKey('longitude')) {
- List geoPoints = [[lat: latestGeoPoint.latitude, lon: latestGeoPoint.longitude, fixedAssetId: fixedAssetId,
- link: [url: 'EditFixedAsset?fixedAssetId=' + fixedAssetId,
- label: uiLabelMap.AccountingFixedAsset + ' ' + fixedAsset.fixedAssetName]
- ]
- ]
-
- Map geoChart = [width: '500px', height: '450px', controlUI: 'small', dataSourceId: latestGeoPoint.dataSourceId, points: geoPoints]
- context.geoChart = geoChart
- }
- if (latestGeoPoint.elevationUomId) {
- elevationUom = from('Uom').where('uomId', latestGeoPoint.elevationUomId).queryOne()
- context.elevationUomAbbr = elevationUom.abbreviation
- }
- }
-}
diff --git a/applications/accounting/groovyScripts/invoice/CreateApplicationList.groovy b/applications/accounting/groovyScripts/invoice/CreateApplicationList.groovy
deleted file mode 100644
index 1c18cf5107..0000000000
--- a/applications/accounting/groovyScripts/invoice/CreateApplicationList.groovy
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.accounting.invoice.InvoiceWorker
-
-import java.text.NumberFormat
-
-// @param GenericValue invoice - The Invoice entity to find payment applications for
-if (!invoice) {
- return
-}
-
-invoiceApplications = [] // to pass back to the screen with payment applications added
-// retrieve related applications with null itemnumber
-invoiceAppls = invoice.getRelated('PaymentApplication', [invoiceItemSeqId: null], null, false)
-invoiceAppls.each { invoiceAppl ->
- itemmap = [
- invoiceId: invoiceAppl.invoiceId,
- invoiceItemSeqId: invoiceAppl.invoiceItemSeqId,
- total: InvoiceWorker.getInvoiceTotal(invoice),
- paymentApplicationId: invoiceAppl.paymentApplicationId,
- paymentId: invoiceAppl.paymentId,
- billingAccountId: invoiceAppl.billingAccountId,
- taxAuthGeoId: invoiceAppl.taxAuthGeoId,
- amountToApply: invoiceAppl.amountApplied,
- amountApplied: invoiceAppl.amountApplied
- ]
- invoiceApplications.add(itemmap)
-}
-
-// retrieve related applications with an existing itemnumber
-invoice.getRelated('InvoiceItem', null, null, false).each { item ->
- BigDecimal itemTotal = null
- if (item.amount != null) {
- if (item.quantity) {
- itemTotal = item.getBigDecimal('amount') * item.getBigDecimal('quantity')
- } else {
- itemTotal = item.getBigDecimal('amount')
- }
- }
- // get relation payment applications for every item(can be more than 1 per item number)
- item.getRelated('PaymentApplication', null, null, false).each { paymentApplication ->
- itemmap = [
- *: item,
- total: NumberFormat.getInstance(locale).format(itemTotal),
- paymentApplicationId: paymentApplication.paymentApplicationId,
- paymentId: paymentApplication.paymentId,
- toPaymentId: paymentApplication.toPaymentId,
- amountApplied: paymentApplication.getBigDecimal('amountApplied'),
- amountToApply: paymentApplication.getBigDecimal('amountApplied'),
- billingAccountId: paymentApplication.billingAccountId,
- taxAuthGeoId: paymentApplication.taxAuthGeoId
- ]
- invoiceApplications.add(itemmap)
- }
-}
-if (invoiceApplications) {
- context.invoiceApplications = invoiceApplications
-}
diff --git a/applications/accounting/groovyScripts/invoice/EditInvoice.groovy b/applications/accounting/groovyScripts/invoice/EditInvoice.groovy
deleted file mode 100644
index 6fc6e2579c..0000000000
--- a/applications/accounting/groovyScripts/invoice/EditInvoice.groovy
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.accounting.invoice.InvoiceWorker
-import org.apache.ofbiz.base.util.UtilNumber
-
-import java.text.DateFormat
-
-invoiceId = parameters.get('invoiceId')
-
-invoice = from('Invoice').where('invoiceId', invoiceId).queryOne()
-context.invoice = invoice
-
-currency = parameters.currency // allow the display of the invoice in the original currency,
- // the default is to display the invoice in the default currency
-BigDecimal conversionRate = new BigDecimal('1')
-decimals = UtilNumber.getBigDecimalScale('invoice.decimals')
-rounding = UtilNumber.getBigDecimalRoundingMode('invoice.rounding')
-
-if (invoice) {
- // each invoice of course has two billing addresses, but the one that is relevant for purchase invoices is the PAYMENT_LOCATION of the invoice
- // (ie Accounts Payable address for the supplier), while the right one for sales invoices is the BILLING_LOCATION (ie Accounts Receivable or
- // home of the customer.)
- if (invoice.invoiceTypeId == 'PURCHASE_INVOICE') {
- billingAddress = InvoiceWorker.getSendFromAddress(invoice)
- } else {
- billingAddress = InvoiceWorker.getBillToAddress(invoice)
- }
- if (billingAddress) {
- context.billingAddress = billingAddress
- }
- billToParty = InvoiceWorker.getBillToParty(invoice)
- context.billToParty = billToParty
- sendingParty = InvoiceWorker.getSendFromParty(invoice)
- context.sendingParty = sendingParty
- shippingAddress = InvoiceWorker.getShippingAddress(invoice)
- context.shippingAddress = shippingAddress
-
- if (currency && invoice.getString('currencyUomId') != currency) {
- conversionRate = InvoiceWorker.getInvoiceCurrencyConversionRate(invoice)
- invoice.currencyUomId = currency
- invoice.invoiceMessage = ' converted from original with a rate of: ' + conversionRate.setScale(8, rounding)
- }
-
- invoiceItems = invoice.getRelated('InvoiceItem', null, ['invoiceItemSeqId'], false)
- invoiceItemsConv = []
- vatTaxesByType = [:]
- invoiceItems.each { invoiceItem ->
- invoiceItem.amount = (invoiceItem.getBigDecimal('amount') * conversionRate).setScale(decimals, rounding)
- invoiceItemsConv.add(invoiceItem)
- // get party tax id for VAT taxes: they are required in invoices by EU
- // also create a map with tax grand total amount by VAT tax: it is also required in invoices by UE
- taxRate = invoiceItem.getRelatedOne('TaxAuthorityRateProduct', false)
- if (taxRate && taxRate.taxAuthorityRateTypeId == 'VAT_TAX') {
- taxInfo = from('PartyTaxAuthInfo')
- .where('partyId', billToParty.partyId, 'taxAuthGeoId', taxRate.taxAuthGeoId, 'taxAuthPartyId', taxRate.taxAuthPartyId)
- .filterByDate(invoice.invoiceDate)
- .queryFirst()
- if (taxInfo) {
- context.billToPartyTaxId = taxInfo.partyTaxId
- }
- taxInfo = from('PartyTaxAuthInfo')
- .where('partyId', sendingParty.partyId, 'taxAuthGeoId', taxRate.taxAuthGeoId, 'taxAuthPartyId', taxRate.taxAuthPartyId)
- .filterByDate(invoice.invoiceDate)
- .queryFirst()
- if (taxInfo) {
- context.sendingPartyTaxId = taxInfo.partyTaxId
- }
- vatTaxesByTypeAmount = vatTaxesByType[taxRate.taxAuthorityRateSeqId] ?: 0.0
- vatTaxesByType.put(taxRate.taxAuthorityRateSeqId, vatTaxesByTypeAmount + invoiceItem.amount)
- }
- }
- context.vatTaxesByType = vatTaxesByType
- context.vatTaxIds = vatTaxesByType.keySet().asList()
-
- context.invoiceItems = invoiceItemsConv
-
- invoiceTotal = (InvoiceWorker.getInvoiceTotal(invoice) * conversionRate).setScale(decimals, rounding)
- invoiceNoTaxTotal = (InvoiceWorker.getInvoiceNoTaxTotal(invoice) * conversionRate).setScale(decimals, rounding)
- context.invoiceTotal = invoiceTotal
- context.invoiceNoTaxTotal = invoiceNoTaxTotal
-
- //*________________this snippet was added for adding Tax ID in invoice header if needed _________________
-
- sendingTaxInfos = sendingParty.getRelated('PartyTaxAuthInfo', null, null, false)
- billingTaxInfos = billToParty.getRelated('PartyTaxAuthInfo', null, null, false)
- sendingPartyTaxId = null
- billToPartyTaxId = null
-
- if (billingAddress) {
- sendingTaxInfos.eachWithIndex { sendingTaxInfo, i ->
- if (sendingTaxInfo.taxAuthGeoId == billingAddress.countryGeoId) {
- sendingPartyTaxId = sendingTaxInfos[i - 1].partyTaxId
- }
- }
- billingTaxInfos.eachWithIndex { billingTaxInfo, i ->
- if (billingTaxInfo.taxAuthGeoId == billingAddress.countryGeoId) {
- billToPartyTaxId = billingTaxInfos[i - 1].partyTaxId
- }
- }
- }
- if (sendingPartyTaxId) {
- context.sendingPartyTaxId = sendingPartyTaxId
- }
- if (billToPartyTaxId && !context.billToPartyTaxId) {
- context.billToPartyTaxId = billToPartyTaxId
- }
- //________________this snippet was added for adding Tax ID in invoice header if needed _________________*/
-
- terms = invoice.getRelated('InvoiceTerm', null, null, false)
- context.terms = terms
-
- paymentAppls = from('PaymentApplication').where('invoiceId', invoiceId).queryList()
- context.payments = paymentAppls
-
- orderItemBillings = from('OrderItemBilling').where('invoiceId', invoiceId).orderBy('orderId').queryList()
- orders = new LinkedHashSet()
- orderItemBillings.each { orderIb ->
- orders.add(orderIb.orderId)
- }
- context.orders = orders
-
- invoiceStatus = invoice.getRelatedOne('StatusItem', false)
- context.invoiceStatus = invoiceStatus
-
- edit = parameters.editInvoice
- if ('true'.equalsIgnoreCase(edit)) {
- invoiceItemTypes = from('InvoiceItemType').queryList()
- context.invoiceItemTypes = invoiceItemTypes
- context.editInvoice = true
- }
-
- // format the date
- if (invoice.invoiceDate) {
- invoiceDate = DateFormat.getDateInstance(DateFormat.LONG).format(invoice.invoiceDate)
- context.invoiceDate = invoiceDate
- } else {
- context.invoiceDate = 'N/A'
- }
-}
diff --git a/applications/accounting/groovyScripts/invoice/GetAccountOrganizationAndClass.groovy b/applications/accounting/groovyScripts/invoice/GetAccountOrganizationAndClass.groovy
deleted file mode 100644
index 3c0d4bbe58..0000000000
--- a/applications/accounting/groovyScripts/invoice/GetAccountOrganizationAndClass.groovy
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.entity.condition.EntityConditionBuilder
-import org.apache.ofbiz.entity.util.EntityUtil
-
-exprBldr = new EntityConditionBuilder()
-invoice = context.invoice
-if (!invoice) {
- return
-}
-glAccountOrganizationAndClassList = null
-switch (invoice.invoiceTypeId) {
- case 'SALES_INVOICE':
- itemTypesCond = exprBldr.OR {
- EQUALS(invoiceItemTypeId: 'SINVOICE_ADJ')
- EQUALS(parentTypeId: 'SINVOICE_ADJ')
- EQUALS(invoiceItemTypeId: 'SINVOICE_ITM_ADJ')
- EQUALS(parentTypeId: 'SINVOICE_ITM_ADJ')
- EQUALS(invoiceItemTypeId: 'INV_PROD_ITEM')
- EQUALS(parentTypeId: 'INV_PROD_ITEM')
- }
- invoiceItemTypes = from('InvoiceItemType').where(itemTypesCond).orderBy(['parentTypeId', 'invoiceItemTypeId']).queryList()
- glAccountOrganizationAndClassList = from('GlAccountOrganizationAndClass').where('organizationPartyId', invoice.partyIdFrom).queryList()
- break
- case 'PURCHASE_INVOICE':
- itemTypesCond = exprBldr.OR {
- EQUALS(invoiceItemTypeId: 'PINVOICE_ADJ')
- EQUALS(parentTypeId: 'PINVOICE_ADJ')
- EQUALS(invoiceItemTypeId: 'PINVOICE_ITM_ADJ')
- EQUALS(parentTypeId: 'PINVOICE_ITM_ADJ')
- EQUALS(invoiceItemTypeId: 'PINV_PROD_ITEM')
- EQUALS(parentTypeId: 'PINV_PROD_ITEM')
- }
- invoiceItemTypes = from('InvoiceItemType').where(itemTypesCond).orderBy(['parentTypeId', 'invoiceItemTypeId']).queryList()
- glAccountOrganizationAndClassList = from('GlAccountOrganizationAndClass').where('organizationPartyId', invoice.partyId).queryList()
- break
- case 'PAYROL_INVOICE':
- itemTypesCond = exprBldr.OR {
- EQUALS(invoiceItemTypeId: 'PAYROL_EARN_HOURS')
- EQUALS(parentTypeId: 'PAYROL_EARN_HOURS')
- EQUALS(invoiceItemTypeId: 'PAYROL_DD_FROM_GROSS')
- EQUALS(parentTypeId: 'PAYROL_DD_FROM_GROSS')
- EQUALS(invoiceItemTypeId: 'PAYROL_TAXES')
- EQUALS(parentTypeId: 'PAYROL_TAXES')
- }
- invoiceItemTypes = from('InvoiceItemType').where(itemTypesCond).orderBy(['parentTypeId', 'invoiceItemTypeId']).queryList()
- glAccountOrganizationAndClassList = from('GlAccountOrganizationAndClass').where('organizationPartyId', invoice.partyId).queryList()
- break
- case 'COMMISSION_INVOICE':
- itemTypesCond = exprBldr.OR {
- EQUALS(invoiceItemTypeId: 'COMM_INV_ITEM')
- EQUALS(parentTypeId: 'COMM_INV_ITEM')
- EQUALS(invoiceItemTypeId: 'COMM_INV_ADJ')
- EQUALS(parentTypeId: 'COMM_INV_ADJ')
- }
- invoiceItemTypes = from('InvoiceItemType').where(itemTypesCond).orderBy(['parentTypeId', 'invoiceItemTypeId']).queryList()
- glAccountOrganizationAndClassList = from('GlAccountOrganizationAndClass').where('organizationPartyId', invoice.partyId).queryList()
- break
- default:
- map = from('InvoiceItemTypeMap').where('invoiceTypeId', invoice.invoiceTypeId).cache(true).queryList()
- invoiceItemTypes = EntityUtil.getRelated('InvoiceItemType', null, map, false)
- break
-}
-context.invoiceItemTypes = invoiceItemTypes
-
-context.glAccountOrganizationAndClassList = glAccountOrganizationAndClassList
diff --git a/applications/accounting/groovyScripts/invoice/InvoiceEvents.groovy b/applications/accounting/groovyScripts/invoice/InvoiceEvents.groovy
deleted file mode 100644
index f6628058b0..0000000000
--- a/applications/accounting/groovyScripts/invoice/InvoiceEvents.groovy
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package invoice
-
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-
-//Create a new Invoice Item with Payrol Item Type
-Map createInvoiceItemPayrol() {
- List<GenericValue> payRolList = from('InvoiceItemType').queryList()
- from('InvoiceItemType')
- .where('parentTypeId', 'PAYROL')
- .queryList()
- .each { payRolGroup ->
- payRolList.each { payRol ->
- if (payRol.parentTypeId == payRolGroup.invoiceItemTypeId) {
- Map createInvoiceItem = [invoiceId: parameters.invoiceId,
- invoiceItemTypeId: payRol.invoiceItemTypeId,
- description: "${payRolGroup.description}: ${payRol.description}",
- quantity: parameters."${payRol.invoiceItemTypeId}_Quantity" ?: 1d,
- amount: parameters."${payRol.invoiceItemTypeId}_Amount" ?: 0d]
-
- if (parameters."${payRol.invoiceItemTypeId}_Quantity" ||
- parameters."${payRol.invoiceItemTypeId}_Amount") {
- if ('PAYROL_EARN_HOURS' != payRolGroup.invoiceItemTypeId) {
- createInvoiceItem.amount = createInvoiceItem.amount.negate()
- }
- Map serviceResult = run service: 'createInvoiceItem', with: createInvoiceItem
- if (ServiceUtil.isError(serviceResult)) {
- return serviceResult
- }
- }
- }
- }
- }
-
- return success()
-}
-
diff --git a/applications/accounting/groovyScripts/invoice/InvoiceReport.groovy b/applications/accounting/groovyScripts/invoice/InvoiceReport.groovy
deleted file mode 100644
index 431ef11fcd..0000000000
--- a/applications/accounting/groovyScripts/invoice/InvoiceReport.groovy
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.base.util.UtilDateTime
-
-exprBldr = new org.apache.ofbiz.entity.condition.EntityConditionBuilder()
-
-if (invoiceTypeId) {
- expr = exprBldr.AND {
- EQUALS(invoiceTypeId: invoiceTypeId)
- LESS_THAN(dueDate: UtilDateTime.nowTimestamp())
- }
- if (invoiceTypeId == 'PURCHASE_INVOICE') {
- invoiceStatusesCondition = exprBldr.IN(statusId: ['INVOICE_RECEIVED', 'INVOICE_IN_PROCESS', 'INVOICE_READY'])
- } else if (invoiceTypeId == 'SALES_INVOICE') {
- invoiceStatusesCondition = exprBldr.IN(statusId: ['INVOICE_SENT', 'INVOICE_APPROVED', 'INVOICE_READY'])
- }
- expr = exprBldr.AND([expr, invoiceStatusesCondition])
-
- PastDueInvoices = from('Invoice').where(expr).orderBy('dueDate DESC').queryList()
- if (PastDueInvoices) {
- invoiceIds = PastDueInvoices.invoiceId
- totalAmount = runService('getInvoiceRunningTotal', [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId])
- if (totalAmount) {
- context.PastDueInvoicestotalAmount = totalAmount.invoiceRunningTotal
- }
- context.PastDueInvoices = PastDueInvoices
- }
-
- invoicesCond = exprBldr.AND(invoiceStatusesCondition) {
- EQUALS(invoiceTypeId: invoiceTypeId)
- GREATER_THAN_EQUAL_TO(dueDate: UtilDateTime.nowTimestamp())
- }
- InvoicesDueSoon = from('Invoice').where(invoicesCond).orderBy('dueDate ASC').maxRows(10).queryList()
- if (InvoicesDueSoon) {
- invoiceIds = InvoicesDueSoon.invoiceId
- totalAmount = runService('getInvoiceRunningTotal', [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId])
- if (totalAmount) {
- context.InvoicesDueSoonTotalAmount = totalAmount.invoiceRunningTotal
- }
- context.InvoicesDueSoon = InvoicesDueSoon
- }
-}
diff --git a/applications/accounting/groovyScripts/invoice/InvoiceServices.groovy b/applications/accounting/groovyScripts/invoice/InvoiceServices.groovy
deleted file mode 100644
index c23d22f557..0000000000
--- a/applications/accounting/groovyScripts/invoice/InvoiceServices.groovy
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.base.util.Debug
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilValidate
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-
-import java.sql.Timestamp
-
-Map getNextInvoiceId() {
- result = success()
-
- // try to find PartyAcctgPreference for parameters.partyId, see if we need any special invoice number sequencing
- GenericValue partyAcctgPreference = from('PartyAcctgPreference').where(parameters).queryOne()
- if (Debug.infoOn()) {
- logInfo("In getNextInvoiceId partyId is [${parameters.partyId}], partyAcctgPreference: ${partyAcctgPreference}")
- }
-
- String customMethodName = null
- String invoiceIdPrefix = ''
- if (partyAcctgPreference) {
- invoiceIdPrefix = partyAcctgPreference.invoiceIdPrefix ?: ''
- //see OFBIZ-3765 beware of OFBIZ-3557
- GenericValue customMethod = partyAcctgPreference.getRelatedOne('InvoiceCustomMethod', true)
- if (customMethod) {
- customMethodName = customMethod.customMethodName
- } else {
- //retrieve service from deprecated enumeration see OFBIZ-3765 beware of OFBIZ-3557
- if (partyAcctgPreference.oldInvoiceSequenceEnumId == 'INVSQ_ENF_SEQ') {
- customMethodName = 'invoiceSequenceEnforced'
- }
- if (partyAcctgPreference.oldInvoiceSequenceEnumId == 'INVSQ_RESTARTYR') {
- customMethodName = 'invoiceSequenceRestart'
- }
- }
- } else {
- logWarning("Acctg preference not defined for partyId [${parameters.partyId}]")
- }
-
- String invoiceIdTemp = ''
- if (customMethodName) {
- parameters.partyAcctgPreference = partyAcctgPreference
- Map serviceResult = run service: customMethodName, with: parameters
- if (ServiceUtil.isError(serviceResult)) {
- return serviceResult
- }
- invoiceIdTemp = serviceResult.invoiceId
- } else {
- logInfo('In createInvoice sequence enum Standard')
- //default to the default sequencing: INVSQ_STANDARD
- invoiceIdTemp = parameters.invoiceId
- if (invoiceIdTemp) {
- //check the provided ID
- errorMsg = UtilValidate.checkValidDatabaseId(invoiceIdTemp)
- if (errorMsg != null) {
- return error("In getNextInvoiceId ${errorMsg}")
- }
- } else {
- invoiceIdTemp = delegator.getNextSeqId('Invoice', 1)
- }
- }
-
- // use invoiceIdTemp along with the invoiceIdPrefix to create the real ID
- result.invoiceId = invoiceIdPrefix + invoiceIdTemp
- return result
-}
-
-Map invoiceSequenceEnforced() {
- result = success()
-
- logInfo('In createInvoice sequence enum Enforced')
- GenericValue partyAcctgPreference = parameters.partyAcctgPreference
- //this is sequential sequencing, we can't skip a number, also it must be a unique sequence per partyIdFrom
-
- Long lastInvoiceNumber = 1
- if (partyAcctgPreference.lastInvoiceNumber) {
- lastInvoiceNumber = partyAcctgPreference.lastInvoiceNumber + 1
- }
-
- partyAcctgPreference.lastInvoiceNumber = lastInvoiceNumber
- delegator.store(partyAcctgPreference)
- result.invoiceId = lastInvoiceNumber
- return result
-}
-
-Map invoiceSequenceRestart() {
- result = success()
-
- logInfo('In createInvoice sequence enum Enforced')
- GenericValue partyAcctgPreference = parameters.partyAcctgPreference
- //this is sequential sequencing, we can't skip a number, also it must be a unique sequence per partyIdFrom
-
- Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
- if (partyAcctgPreference.lastInvoiceRestartDate) {
- //first figure out if we need to reset the lastInvoiceNumber; is the lastInvoiceRestartDate after the fiscalYearStartMonth/Day for this year?
- curYearFiscalStartDate = UtilDateTime.getYearStart(nowTimestamp,
- partyAcctgPreference.fiscalYearStartDay, partyAcctgPreference.fiscalYearStartMonth, 0L)
- if (partyAcctgPreference.lastInvoiceRestartDate < curYearFiscalStartDate && nowTimestamp >= curYearFiscalStartDate) {
- //less than fiscal year start, we need to reset it
- partyAcctgPreference.lastInvoiceNumber = 1L
- partyAcctgPreference.lastInvoiceRestartDate = nowTimestamp
- } else {
- //greater than or equal to fiscal year start or nowTimestamp hasn't yet hit the current year fiscal start date, we're okay, just increment
- partyAcctgPreference.lastInvoiceNumber += 1L
- }
- } else {
- //if no lastInvoiceRestartDate then it's easy, just start now with 1
- partyAcctgPreference.lastInvoiceNumber = 1L
- partyAcctgPreference.lastInvoiceRestartDate = nowTimestamp
- }
- delegator.store(partyAcctgPreference)
-
- //get the current year string for prefix, etc; simple 4 digit year date string (using system defaults)
- Integer curYearString = UtilDateTime.getYear(partyAcctgPreference.lastInvoiceRestartDate, timeZone, locale)
- return success(invoiceId: "${curYearString}-${partyAcctgPreference.lastInvoiceNumber}")
-}
-
diff --git a/applications/accounting/groovyScripts/invoice/ListNotAppliedPayments.groovy b/applications/accounting/groovyScripts/invoice/ListNotAppliedPayments.groovy
deleted file mode 100644
index fa93f2f353..0000000000
--- a/applications/accounting/groovyScripts/invoice/ListNotAppliedPayments.groovy
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.accounting.invoice.InvoiceWorker
-import org.apache.ofbiz.accounting.payment.PaymentWorker
-import org.apache.ofbiz.base.util.UtilNumber
-import org.apache.ofbiz.entity.condition.EntityConditionBuilder
-
-invoiceId = parameters.invoiceId
-invoice = from('Invoice').where(invoiceId: invoiceId).queryOne()
-
-decimals = UtilNumber.getBigDecimalScale('invoice.decimals')
-rounding = UtilNumber.getBigDecimalRoundingMode('invoice.rounding')
-
-exprBldr = new EntityConditionBuilder()
-preCurrencyCond = exprBldr.AND {
- EQUALS(partyIdTo: invoice.partyIdFrom)
- EQUALS(partyIdFrom: invoice.partyId)
- IN(statusId: ['PMNT_NOT_PAID', 'PMNT_RECEIVED', 'PMNT_SENT'])
-}
-
-topCond = exprBldr.AND(preCurrencyCond) {
- EQUALS(currencyUomId: invoice.currencyUomId)
-}
-
-topCondActual = exprBldr.AND(preCurrencyCond) {
- EQUALS(actualCurrencyUomId: invoice.currencyUomId)
-}
-
-payments = from('Payment').where(topCond).orderBy('effectiveDate').queryList()
-context.payments = getPayments(payments, false)
-payments = from('Payment').where(topCondActual).orderBy('effectiveDate').queryList()
-context.paymentsActualCurrency = getPayments(payments, true)
-
-List getPayments(List payments, boolean actual) {
- if (payments) {
- paymentList = [] // to pass back to the screeen list of unapplied payments
- invoiceApplied = InvoiceWorker.getInvoiceApplied(invoice)
- invoiceAmount = InvoiceWorker.getInvoiceTotal(invoice)
- invoiceToApply = InvoiceWorker.getInvoiceNotApplied(invoice)
- payments.each { payment ->
- paymentMap = [:]
- paymentApplied = PaymentWorker.getPaymentApplied(payment, true)
- if (actual) {
- paymentMap.amount = payment.actualCurrencyAmount
- paymentMap.currencyUomId = payment.actualCurrencyUomId
- paymentToApply = payment.getBigDecimal('actualCurrencyAmount')?.setScale(decimals, rounding)?.subtract(paymentApplied)
- } else {
- paymentMap.amount = payment.amount
- paymentMap.currencyUomId = payment.currencyUomId
- paymentToApply = payment.getBigDecimal('amount')?.setScale(decimals, rounding)?.subtract(paymentApplied)
- }
- if (paymentToApply?.signum() == 1) {
- paymentMap.paymentId = payment.paymentId
- paymentMap.effectiveDate = payment.effectiveDate
- if (paymentToApply < invoiceToApply) {
- paymentMap.amountToApply = paymentToApply
- } else {
- paymentMap.amountToApply = invoiceToApply
- }
- paymentList.add(paymentMap)
- }
- }
- return paymentList
- }
-}
diff --git a/applications/accounting/groovyScripts/invoice/PrintInvoices.groovy b/applications/accounting/groovyScripts/invoice/PrintInvoices.groovy
deleted file mode 100644
index 85b6d9f12b..0000000000
--- a/applications/accounting/groovyScripts/invoice/PrintInvoices.groovy
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.accounting.invoice.InvoiceWorker
-import org.apache.ofbiz.base.util.UtilNumber
-
-import java.text.DateFormat
-
-invoiceDetailList = []
-invoiceIds.each { invoiceId ->
- invoicesMap = [:]
- invoice = from('Invoice').where('invoiceId', invoiceId).queryOne()
- invoicesMap.invoice = invoice
-
- currency = parameters.currency // allow the display of the invoice in the original currency,
- // the default is to display the invoice in the default currency
- BigDecimal conversionRate = new BigDecimal('1')
- ZERO = BigDecimal.ZERO
- decimals = UtilNumber.getBigDecimalScale('invoice.decimals')
- rounding = UtilNumber.getBigDecimalRoundingMode('invoice.rounding')
-
- if (invoice) {
- if (currency && invoice.getString('currencyUomId') != currency) {
- conversionRate = InvoiceWorker.getInvoiceCurrencyConversionRate(invoice)
- invoice.currencyUomId = currency
- invoice.invoiceMessage = ' converted from original with a rate of: ' + conversionRate.setScale(8, rounding)
- }
-
- invoiceItems = invoice.getRelated('InvoiceItem', null, ['invoiceItemSeqId'], false)
- invoiceItemsConv = []
- invoiceItems.each { invoiceItem ->
- if (invoiceItem.amount) {
- invoiceItem.amount = (invoiceItem.getBigDecimal('amount') * conversionRate).setScale(decimals, rounding)
- invoiceItemsConv.add(invoiceItem)
- }
- }
-
- invoicesMap.invoiceItems = invoiceItemsConv
-
- invoiceTotal = (InvoiceWorker.getInvoiceTotal(invoice) * conversionRate).setScale(decimals, rounding)
- invoiceNoTaxTotal = (InvoiceWorker.getInvoiceNoTaxTotal(invoice) * conversionRate).setScale(decimals, rounding)
- invoicesMap.invoiceTotal = invoiceTotal
- invoicesMap.invoiceNoTaxTotal = invoiceNoTaxTotal
-
- if (invoice.invoiceTypeId == 'PURCHASE_INVOICE') {
- billingAddress = InvoiceWorker.getSendFromAddress(invoice)
- } else {
- billingAddress = InvoiceWorker.getBillToAddress(invoice)
- }
- if (billingAddress) {
- invoicesMap.billingAddress = billingAddress
- }
- billToParty = InvoiceWorker.getBillToParty(invoice)
- invoicesMap.billToParty = billToParty
- sendingParty = InvoiceWorker.getSendFromParty(invoice)
- invoicesMap.sendingParty = sendingParty
-
- // This snippet was added for adding Tax ID in invoice header if needed
- sendingTaxInfos = sendingParty.getRelated('PartyTaxAuthInfo', null, null, false)
- billingTaxInfos = billToParty.getRelated('PartyTaxAuthInfo', null, null, false)
- sendingPartyTaxId = null
- billToPartyTaxId = null
-
- if (billingAddress) {
- sendingTaxInfos.eachWithIndex { sendingTaxInfo, i ->
- if (sendingTaxInfo.taxAuthGeoId == billingAddress.countryGeoId) {
- sendingPartyTaxId = sendingTaxInfos[i - 1].partyTaxId
- }
- }
- billingTaxInfos.eachWithIndex { billingTaxInfo, i ->
- if (billingTaxInfo.taxAuthGeoId == billingAddress.countryGeoId) {
- billToPartyTaxId = billingTaxInfos[i - 1].partyTaxId
- }
- }
- }
- if (sendingPartyTaxId) {
- invoicesMap.sendingPartyTaxId = sendingPartyTaxId
- }
- if (billToPartyTaxId) {
- invoicesMap.billToPartyTaxId = billToPartyTaxId
- }
-
- terms = invoice.getRelated('InvoiceTerm', null, null, false)
- invoicesMap.terms = terms
-
- paymentAppls = from('PaymentApplication').where('invoiceId', invoiceId).queryList()
- invoicesMap.payments = paymentAppls
-
- orderItemBillings = from('OrderItemBilling').where('invoiceId', invoiceId).orderBy('orderId').queryList()
- orders = new LinkedHashSet()
- orderItemBillings.each { orderIb ->
- orders.add(orderIb.orderId)
- }
- invoicesMap.orders = orders
-
- invoiceStatus = invoice.getRelatedOne('StatusItem', false)
- invoicesMap.invoiceStatus = invoiceStatus
-
- edit = parameters.editInvoice
- if ('true'.equalsIgnoreCase(edit)) {
- invoiceItemTypes = from('InvoiceItemType').queryList()
- invoicesMap.invoiceItemTypes = invoiceItemTypes
- invoicesMap.editInvoice = true
- }
-
- // format the date
- if (invoice.invoiceDate) {
- invoiceDate = DateFormat.getDateInstance(DateFormat.LONG).format(invoice.invoiceDate)
- invoicesMap.invoiceDate = invoiceDate
- } else {
- invoicesMap.invoiceDate = 'N/A'
- }
- }
- invoiceDetailList.add(invoicesMap)
-}
-
-context.invoiceDetailList = invoiceDetailList
diff --git a/applications/accounting/groovyScripts/ledger/GeneralLedgerServices.groovy b/applications/accounting/groovyScripts/ledger/GeneralLedgerServices.groovy
deleted file mode 100644
index 69f4bfd350..0000000000
--- a/applications/accounting/groovyScripts/ledger/GeneralLedgerServices.groovy
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.entity.GenericValue
-
-/**
- * Create a new Accounting Transaction (AcctgTrans) with isPosted set to 'N'.
- *
- * @param parameters Contains all attributes for service interface, interfaceAcctgTrans.
- * @return Success response containing the AcctgTrans primary key, error response otherwise.
- */
-Map createAcctgTrans() {
- GenericValue newAcctgTrans = makeValue('AcctgTrans', [*:parameters, isPosted: 'N'])
- newAcctgTrans.acctgTransId = delegator.getNextSeqId('AcctgTrans')
- newAcctgTrans.create()
-
- return success([acctgTransId: newAcctgTrans.acctgTransId])
-}
diff --git a/applications/accounting/groovyScripts/order/BillingAccountOrders.groovy b/applications/accounting/groovyScripts/order/BillingAccountOrders.groovy
deleted file mode 100644
index beafc61c4c..0000000000
--- a/applications/accounting/groovyScripts/order/BillingAccountOrders.groovy
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-if (billingAccountId) {
- orderPaymentPreferencesList = []
- orderList = from('OrderHeader').where('billingAccountId', billingAccountId).queryList()
- if (orderList) {
- orderList.each { orderHeader ->
- orderId = orderHeader.orderId
- orderBillingAcc = from('OrderHeaderAndPaymentPref').where('orderId', orderId).queryFirst()
- orderBillingAccMap = [:]
- if (orderBillingAcc.paymentMethodTypeId == 'EXT_BILLACT' && orderBillingAcc.paymentStatusId == 'PAYMENT_NOT_RECEIVED') {
- orderBillingAccMap.putAll(orderBillingAcc)
- orderId = orderBillingAcc.orderId
- orderBillingAccMap.orderId = orderId
- }
- orderPaymentPreferencesList.add(orderBillingAccMap)
- }
- context.orderPaymentPreferencesList = orderPaymentPreferencesList
- }
-}
diff --git a/applications/accounting/groovyScripts/payment/BillingAccounts.groovy b/applications/accounting/groovyScripts/payment/BillingAccounts.groovy
deleted file mode 100644
index 0bf74f8b91..0000000000
--- a/applications/accounting/groovyScripts/payment/BillingAccounts.groovy
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.accounting.payment.BillingAccountWorker
-
-partyId = parameters.partyId
-currencyUomId = null
-billingAccounts = []
-if (partyId) {
- billingAccountAndRoles = from('BillingAccountAndRole').where('partyId', partyId).queryList()
- if (billingAccountAndRoles) {
- currencyUomId = billingAccountAndRoles.first().accountCurrencyUomId
- }
- if (currencyUomId) {
- billingAccounts = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher)
- }
-}
-context.billingAccounts = billingAccounts
diff --git a/applications/accounting/groovyScripts/payment/DepositWithdrawPayments.groovy b/applications/accounting/groovyScripts/payment/DepositWithdrawPayments.groovy
deleted file mode 100644
index 95b2821286..0000000000
--- a/applications/accounting/groovyScripts/payment/DepositWithdrawPayments.groovy
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-import org.apache.ofbiz.entity.util.EntityUtil
-
-if (parameters.noConditionFind == 'Y') {
- List exprListForParameters = []
-
- finAccountRoles = from('FinAccountRole').where('finAccountId', finAccountId, 'roleTypeId', 'DIVISION').filterByDate().queryList()
- finAccountPartyIds = EntityUtil.getFieldListFromEntityList(finAccountRoles, 'partyId', true)
- finAccountPartyIds.add(organizationPartyId)
- partyCond = EntityCondition.makeCondition([EntityCondition.makeCondition('partyIdTo', EntityOperator.IN, finAccountPartyIds),
- EntityCondition.makeCondition('partyIdFrom', EntityOperator.IN, finAccountPartyIds)],
- EntityOperator.OR)
- statusCond = EntityCondition.makeCondition([EntityCondition.makeCondition('statusId', EntityOperator.EQUALS, 'PMNT_RECEIVED'),
- EntityCondition.makeCondition('statusId', EntityOperator.EQUALS, 'PMNT_SENT')], EntityOperator.OR)
-
- if (paymentMethodTypeId) {
- exprListForParameters.add(EntityCondition.makeCondition('paymentMethodTypeId', EntityOperator.EQUALS, paymentMethodTypeId))
- }
- if (fromDate) {
- exprListForParameters.add(EntityCondition.makeCondition('effectiveDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
- }
- if (thruDate) {
- exprListForParameters.add(EntityCondition.makeCondition('effectiveDate', EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
- }
- if (partyIdFrom) {
- exprListForParameters.add(EntityCondition.makeCondition('partyIdFrom', EntityOperator.EQUALS, partyIdFrom))
- }
- exprListForParameters.add(EntityCondition.makeCondition('finAccountTransId', EntityOperator.EQUALS, null))
- paramCond = EntityCondition.makeCondition(exprListForParameters, EntityOperator.AND)
- combinedPaymentCond = EntityCondition.makeCondition([partyCond, statusCond, paramCond], EntityOperator.AND)
- payments = from('PaymentAndTypePartyNameView').where(combinedPaymentCond).queryList()
- paymentListWithCreditCard = []
- paymentListWithoutCreditCard = []
- payments.each { payment ->
- if (cardType && payment.paymentMethodId) {
- creditCard = from('CreditCard').where('paymentMethodId', payment.paymentMethodId).queryOne()
- if (creditCard.cardType == cardType) {
- paymentListWithCreditCard.add(payment)
- }
- } else if (!cardType) {
- paymentListWithoutCreditCard.add(payment)
- }
- }
- if (paymentListWithCreditCard) {
- context.paymentList = paymentListWithCreditCard
- } else {
- context.paymentList = paymentListWithoutCreditCard
- }
-}
diff --git a/applications/accounting/groovyScripts/payment/FindInvoicesByDueDate.groovy b/applications/accounting/groovyScripts/payment/FindInvoicesByDueDate.groovy
deleted file mode 100644
index 05af405a31..0000000000
--- a/applications/accounting/groovyScripts/payment/FindInvoicesByDueDate.groovy
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.service.ModelService
-
-context.invoicePaymentInfoList = []
-
-if (parameters.invoiceTypeId) { // it's not the initialisation but a real search request
- serviceCtx = dispatcher.getDispatchContext().makeValidContext('getInvoicePaymentInfoListByDueDateOffset', ModelService.IN_PARAM, parameters)
- result = runService('getInvoicePaymentInfoListByDueDateOffset', serviceCtx)
- context.invoicePaymentInfoList = result.invoicePaymentInfoList
-}
diff --git a/applications/accounting/groovyScripts/payment/ListNotAppliedInvoices.groovy b/applications/accounting/groovyScripts/payment/ListNotAppliedInvoices.groovy
deleted file mode 100644
index 1212a17928..0000000000
--- a/applications/accounting/groovyScripts/payment/ListNotAppliedInvoices.groovy
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.accounting.invoice.InvoiceWorker
-import org.apache.ofbiz.accounting.payment.PaymentWorker
-import org.apache.ofbiz.base.util.UtilNumber
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-
-paymentId = parameters.paymentId
-payment = from('Payment').where('paymentId', paymentId).queryOne()
-
-decimals = UtilNumber.getBigDecimalScale('invoice.decimals')
-rounding = UtilNumber.getBigDecimalRoundingMode('invoice.rounding')
-
-exprList = [EntityCondition.makeCondition('partyId', EntityOperator.EQUALS, payment.partyIdFrom),
- EntityCondition.makeCondition('partyIdFrom', EntityOperator.EQUALS, payment.partyIdTo)]
-partyCond = EntityCondition.makeCondition(exprList, EntityOperator.AND)
-
-exprList1 = [EntityCondition.makeCondition('statusId', EntityOperator.EQUALS, 'INVOICE_APPROVED'),
- EntityCondition.makeCondition('statusId', EntityOperator.EQUALS, 'INVOICE_SENT'),
- EntityCondition.makeCondition('statusId', EntityOperator.EQUALS, 'INVOICE_READY'),
- EntityCondition.makeCondition('statusId', EntityOperator.EQUALS, 'INVOICE_RECEIVED')]
-statusCond = EntityCondition.makeCondition(exprList1, EntityOperator.OR)
-
-currCond = EntityCondition.makeCondition('currencyUomId', EntityOperator.EQUALS, payment.currencyUomId)
-actualCurrCond = EntityCondition.makeCondition('currencyUomId', EntityOperator.EQUALS, payment.actualCurrencyUomId)
-
-topCond = EntityCondition.makeCondition([partyCond, statusCond, currCond], EntityOperator.AND)
-topCondActual = EntityCondition.makeCondition([partyCond, statusCond, actualCurrCond], EntityOperator.AND)
-
-//retrieve invoices for the related parties which have not been (fully) applied yet and which have the same currency as the payment
-invoices = select('invoiceId', 'invoiceTypeId', 'currencyUomId', 'description', 'invoiceDate')
- .from('Invoice')
- .where(topCond)
- .orderBy('invoiceDate')
- .queryList()
-context.invoices = getInvoices(invoices, false)
-//retrieve invoices for the related parties which have not been (fully) applied yet and which have the same originalCurrency as the payment
-invoices = select('invoiceId', 'invoiceTypeId', 'currencyUomId', 'description', 'invoiceDate')
- .from('Invoice')
- .where(topCondActual)
- .orderBy('invoiceDate')
- .queryList()
-context.invoicesOtherCurrency = getInvoices(invoices, true)
-
-List getInvoices(List invoices, boolean actual) {
- if (invoices) {
- invoicesList = [] // to pass back to the screeen list of unapplied invoices
- paymentApplied = PaymentWorker.getPaymentApplied(payment)
- paymentToApply = payment.getBigDecimal('amount').setScale(decimals, rounding).subtract(paymentApplied)
- if (actual && payment.actualCurrencyAmount) {
- paymentToApply = payment.getBigDecimal('actualCurrencyAmount').setScale(decimals, rounding).subtract(paymentApplied)
- }
- invoices.each { invoice ->
- invoiceAmount = InvoiceWorker.getInvoiceTotal(invoice).setScale(decimals, rounding)
- invoiceApplied = InvoiceWorker.getInvoiceApplied(invoice).setScale(decimals, rounding)
- invoiceToApply = invoiceAmount.subtract(invoiceApplied)
- if (invoiceToApply.signum() == 1) {
- invoiceMap = [:]
- invoiceMap.putAll(invoice)
- invoiceMap.amount = invoiceAmount
- invoiceMap.description = invoice.description
- invoiceMap.amountApplied = invoiceApplied
- if (paymentToApply < invoiceToApply) {
- invoiceMap.amountToApply = paymentToApply
- } else {
- invoiceMap.amountToApply = invoiceToApply
- }
- invoicesList.add(invoiceMap)
- }
- }
- return invoicesList
- }
-}
diff --git a/applications/accounting/groovyScripts/payment/ListNotAppliedPayments.groovy b/applications/accounting/groovyScripts/payment/ListNotAppliedPayments.groovy
deleted file mode 100644
index fbfd488947..0000000000
--- a/applications/accounting/groovyScripts/payment/ListNotAppliedPayments.groovy
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.accounting.payment.PaymentWorker
-import org.apache.ofbiz.base.util.UtilNumber
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-
-basePaymentId = parameters.paymentId
-basePayment = from('Payment').where('paymentId', basePaymentId).queryOne()
-
-decimals = UtilNumber.getBigDecimalScale('invoice.decimals')
-rounding = UtilNumber.getBigDecimalRoundingMode('invoice.rounding')
-
-paymentsMapList = [] // to pass back to the screeen list of unapplied payments
-
-// retrieve payments for the related parties which have not been (fully) applied yet
-List payments = null
-exprList = []
-expr = EntityCondition.makeCondition('partyIdTo', EntityOperator.EQUALS, basePayment.getString('partyIdFrom'))
-exprList.add(expr)
-expr = EntityCondition.makeCondition('partyIdFrom', EntityOperator.EQUALS, basePayment.getString('partyIdTo'))
-exprList.add(expr)
-expr = EntityCondition.makeCondition('paymentId', EntityOperator.NOT_EQUAL, basePayment.getString('paymentId'))
-exprList.add(expr)
-
-// only payments with received and sent
-exprListStatus = []
-expr = EntityCondition.makeCondition('statusId', EntityOperator.EQUALS, 'PMNT_RECEIVED')
-exprListStatus.add(expr)
-expr = EntityCondition.makeCondition('statusId', EntityOperator.EQUALS, 'PMNT_SENT')
-exprListStatus.add(expr)
-orCond = EntityCondition.makeCondition(exprListStatus, EntityOperator.OR)
-exprList.add(orCond)
-
-topCond = EntityCondition.makeCondition(exprList, EntityOperator.AND)
-
-payments = from('Payment').where(topCond).orderBy('effectiveDate').queryList()
-
-if (payments) {
- basePaymentApplied = PaymentWorker.getPaymentApplied(basePayment)
- basePaymentAmount = basePayment.getBigDecimal('amount')
- basePaymentToApply = basePaymentAmount.subtract(basePaymentApplied)
- payments.each { payment ->
- if (PaymentWorker.getPaymentNotApplied(payment).signum() == 1) { // positiv not applied amount?
- // yes, put in the map
- paymentMap = [:]
- paymentMap.paymentId = basePaymentId
- paymentMap.toPaymentId = payment.paymentId
- paymentMap.currencyUomId = payment.currencyUomId
- paymentMap.effectiveDate = payment.effectiveDate.toString().substring(0, 10) // list as YYYY-MM-DD
- paymentMap.amount = payment.getBigDecimal('amount')
- paymentMap.amountApplied = PaymentWorker.getPaymentApplied(payment)
- paymentToApply = PaymentWorker.getPaymentNotApplied(payment)
- if (paymentToApply < basePaymentToApply) {
- paymentMap.amountToApply = paymentToApply
- } else {
- paymentMap.amountToApply = basePaymentToApply
- }
- paymentsMapList.add(paymentMap)
- }
- }
-}
-context.payments = paymentsMapList
diff --git a/applications/accounting/groovyScripts/payment/ManualTx.groovy b/applications/accounting/groovyScripts/payment/ManualTx.groovy
deleted file mode 100644
index 2a4e26d58f..0000000000
--- a/applications/accounting/groovyScripts/payment/ManualTx.groovy
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-// stores
-productStores = from('ProductStore').orderBy('storeName').cache(true).queryList()
-context.productStores = productStores
-
-// current store
-productStoreId = parameters.productStoreId
-if (productStoreId) {
- productStore = from('ProductStore').where('productStoreId', productStoreId).queryOne()
- context.currentStore = productStore
-}
-
-// payment settings
-paymentSettings = from('Enumeration').where('enumTypeId', 'PRDS_PAYSVC').orderBy('sequenceId').queryList()
-context.paymentSettings = paymentSettings
-
-// payment method (for auto-fill)
-paymentMethodId = parameters.paymentMethodId
-context.paymentMethodId = paymentMethodId
-
-// payment method type
-paymentMethodTypeId = parameters.paymentMethodTypeId
-context.paymentMethodTypeId = paymentMethodTypeId
-
-// service type (transaction type)
-txType = parameters.transactionType
-context.txType = txType
-if (txType) {
- currentTx = from('Enumeration').where('enumId', txType).queryOne()
- context.currentTx = currentTx
-}
-
-if (paymentMethodId) {
- paymentMethod = from('PaymentMethod').where('paymentMethodId', paymentMethodId).queryOne()
- if (paymentMethod) {
- // payment method type
- paymentMethodTypeId = paymentMethod.paymentMethodTypeId
-
- // party information
- party = paymentMethod.getRelatedOne('Party', false)
- if (party && party.partyTypeId == 'PERSON') {
- person = party.getRelatedOne('Person', false)
- context.person = person
- } else if (party && party.partyTypeId == 'PARTY_GROUP') {
- partyGroup = party.getRelatedOne('PartyGroup', false)
- context.partyGroup = partyGroup
- }
-
- // method info + address
- creditCard = paymentMethod.getRelatedOne('CreditCard', false)
- context.put('creditCard', creditCard)
- if (creditCard) {
- postalAddress = creditCard.getRelatedOne('PostalAddress', false)
- context.postalFields = postalAddress
- }
-
- giftCard = paymentMethod.getRelatedOne('GiftCard', false)
- context.giftCard = giftCard
-
- // todo add support for eft account
- }
-}
-
-if (paymentMethodTypeId) {
- paymentMethodType = from('PaymentMethodType').where('paymentMethodTypeId', paymentMethodTypeId).queryOne()
- context.paymentMethodType = paymentMethodType
- context.paymentMethodTypeId = paymentMethodTypeId
-}
-
-context.showToolTip = 'true'
diff --git a/applications/accounting/groovyScripts/payment/PaymentServices.groovy b/applications/accounting/groovyScripts/payment/PaymentServices.groovy
deleted file mode 100644
index 9b9355de4e..0000000000
--- a/applications/accounting/groovyScripts/payment/PaymentServices.groovy
+++ /dev/null
@@ -1,961 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-import org.apache.ofbiz.accounting.invoice.InvoiceWorker
-import org.apache.ofbiz.accounting.payment.PaymentWorker
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilFormatOut
-import org.apache.ofbiz.base.util.UtilMisc
-import org.apache.ofbiz.base.util.UtilProperties
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityConditionBuilder
-import org.apache.ofbiz.entity.condition.EntityOperator
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.entity.util.EntityTypeUtil
-import org.apache.ofbiz.entity.util.EntityUtilProperties
-import org.apache.ofbiz.service.ServiceUtil
-
-import java.sql.Timestamp
-import org.apache.ofbiz.accounting.util.UtilAccounting
-
-Map createPayment() {
- if (!security.hasEntityPermission('ACCOUNTING', '_CREATE', parameters.userLogin) &&
- (!security.hasEntityPermission('PAY_INFO', '_CREATE', parameters.userLogin) &&
- userLogin.partyId != parameters.partyIdFrom && userLogin.partyId != parameters.partyIdTo)) {
- return error(label('AccountingUiLabels', 'AccountingCreatePaymentPermissionError'))
- }
-
- GenericValue payment = makeValue('Payment')
- payment.paymentId = parameters.paymentId ?: delegator.getNextSeqId('Payment')
- parameters.statusId = parameters.statusId ?: 'PMNT_NOT_PAID'
-
- if (parameters.paymentMethodId) {
- GenericValue paymentMethod = from('PaymentMethod').where('paymentMethodId', parameters.paymentMethodId).queryOne()
- if (parameters.paymentMethodTypeId != paymentMethod.paymentMethodTypeId) {
- logInfo('Replacing passed payment method type [' + parameters.paymentMethodTypeId + '] with payment method type ['
- + paymentMethod.paymentMethodTypeId + '] for payment method [' + parameters.paymentMethodId + ']')
- parameters.paymentMethodTypeId = paymentMethod.paymentMethodTypeId
- }
- }
-
- if (parameters.paymentPreferenceId) {
- GenericValue orderPaymentPreference = from('OrderPaymentPreference')
- .where('orderPaymentPreferenceId', parameters.paymentPreferenceId).queryOne()
- parameters.paymentId = parameters.paymentId ?: orderPaymentPreference.paymentMethodId
- parameters.paymentMethodTypeId = parameters.paymentMethodTypeId ?: orderPaymentPreference.paymentMethodTypeId
- }
-
- if (!parameters.paymentMethodTypeId) {
- return error(label('AccountingUiLabels', 'AccountingPaymentMethodIdPaymentMethodTypeIdNullError'))
- }
-
- payment.setNonPKFields(parameters)
- payment.effectiveDate = payment.effectiveDate ?: UtilDateTime.nowTimestamp()
- payment.create()
- return success(paymentId: payment.paymentId)
-}
-
-Map getInvoicePaymentInfoList() {
- // Create a list with information on payment due dates and amounts for the invoice
- GenericValue invoice = parameters.invoice ?: from('Invoice').where('invoiceId', parameters.invoiceId).queryOne()
- List invoicePaymentInfoList = []
-
- BigDecimal invoiceTotalAmount = InvoiceWorker.getInvoiceTotal(invoice)
- BigDecimal invoiceTotalAmountPaid = InvoiceWorker.getInvoiceApplied(invoice)
-
- List invoiceTerms = from('InvoiceTerm')
- .where('invoiceId', invoice.invoiceId)
- .queryList()
-
- BigDecimal remainingAppliedAmount = invoiceTotalAmountPaid
- BigDecimal computedTotalAmount = (BigDecimal) 0
-
- for (invoiceTerm in invoiceTerms) {
- GenericValue termType = from('TermType').where('termTypeId', invoiceTerm.termTypeId).cache().queryOne()
- if (termType.parentTypeId == 'FIN_PAYMENT_TERM') {
- Map invoicePaymentInfo = [invoiceId: invoice.invoiceId,
- invoiceTermId: invoiceTerm.invoiceTermId,
- termTypeId: invoiceTerm.termTypeId,
- dueDate: UtilDateTime.getDayEnd(invoice.invoiceDate, invoiceTerm.termDays)]
-
- BigDecimal invoiceTermAmount = (invoiceTerm.termValue * invoiceTotalAmount ) / 100
- invoicePaymentInfo.amount = invoiceTermAmount
- computedTotalAmount += invoicePaymentInfo.amount as BigDecimal
-
- if (remainingAppliedAmount >= invoiceTermAmount) {
- invoicePaymentInfo.paidAmount = invoiceTermAmount
- remainingAppliedAmount -= invoiceTermAmount
- } else {
- invoicePaymentInfo.paidAmount = remainingAppliedAmount
- remainingAppliedAmount = (BigDecimal) 0
- }
- invoicePaymentInfo.outstandingAmount = invoicePaymentInfo.amount - invoicePaymentInfo.paidAmount
- invoicePaymentInfoList << invoicePaymentInfo
- }
- }
-
- if (remainingAppliedAmount > 0.0 || invoiceTotalAmount <= 0.0 || computedTotalAmount < invoiceTotalAmount) {
- Map invoicePaymentInfo = [invoiceId: invoice.invoiceId,
- amount: invoiceTotalAmount - computedTotalAmount,
- paidAmount: remainingAppliedAmount]
- invoicePaymentInfo.outstandingAmount = invoicePaymentInfo.amount - invoicePaymentInfo.paidAmount
- GenericValue invoiceTerm = from('InvoiceTerm')
- .where('invoiceId', invoice.invoiceId,
- 'termTypeId', 'FIN_PAYMENT_TERM')
- .queryFirst()
- if (invoiceTerm) {
- invoicePaymentInfo.termTypeId = invoiceTerm.termTypeId
- invoicePaymentInfo.dueDate = UtilDateTime.getDayEnd(invoice.invoiceDate, invoiceTerm.termDays)
- } else {
- invoicePaymentInfo.dueDate = UtilDateTime.getDayEnd(invoice.invoiceDate)
- }
- invoicePaymentInfoList << invoicePaymentInfo
- }
- return success(invoicePaymentInfoList: invoicePaymentInfoList)
-}
-
-Map updatePayment() {
- GenericValue payment = from('Payment').where(parameters).queryOne()
- if (!security.hasEntityPermission('ACCOUNTING', '_UPDATE', parameters.userLogin) &&
- (!security.hasEntityPermission('PAY_INFO', '_UPDATE', parameters.userLogin) &&
- userLogin.partyId != payment.partyIdFrom && userLogin.partyId != payment.partyIdTo)) {
- return error(label('AccountingUiLabels', 'AccountingUpdatePaymentPermissionError'))
- }
- if ('PMNT_NOT_PAID' != payment.statusId) {
- // check if only status change
- GenericValue oldPayment = makeValue('Payment', payment)
- GenericValue newPayment = makeValue('Payment', payment)
- newPayment.setNonPKFields(parameters)
-
- // fields :- comments, paymentRefNum, finAccountTransId, statusIhStatus does not allow an update of the information are editable for Payment
- oldPayment.statusId = newPayment.statusId
- oldPayment.comments = newPayment.comments
- oldPayment.paymentRefNum = newPayment.paymentRefNum ?: null
- oldPayment.finAccountTransId = newPayment.finAccountTransId ?: null
- if (oldPayment != newPayment) {
- return error(label('AccountingUiLabels', 'AccountingPSUpdateNotAllowedBecauseOfStatus'))
- }
- }
- String statusIdSave = payment.statusId // do not allow status change here
- payment.setNonPKFields(parameters)
- payment.statusId = statusIdSave // do not allow status change here
- payment.effectiveDate = payment.effectiveDate ?: UtilDateTime.nowTimestamp()
- if (payment.paymentMethodId) {
- GenericValue paymentMethod = from('PaymentMethod').where('paymentMethodId', payment.paymentMethodId).queryOne()
- if (payment.paymentMethodTypeId != paymentMethod.paymentMethodTypeId) {
- logInfo('Replacing passed payment method type [' + parameters.paymentMethodTypeId + '] with payment method type [' +
- paymentMethod.paymentMethodTypeId + '] for payment method [' + parameters.paymentMethodId + ']')
- }
- payment.paymentMethodTypeId = paymentMethod.paymentMethodTypeId
- }
- payment.store()
- if (parameters.statusId &&
- parameters.statusId != statusIdSave) {
- Map serviceResult = run service: 'setPaymentStatus', with: [* : parameters,
- paymentId: payment.paymentId]
- if (!ServiceUtil.isSuccess(serviceResult)) {
- return serviceResult
- }
- }
- return success()
-}
-
-Map createPaymentAndApplicationForParty() {
- BigDecimal paymentAmount = 0
- List invoiceIds = []
- String paymentId
- parameters.invoices.each { GenericValue invoice ->
- if (invoice.statusId == 'INVOICE_READY') {
- Map serviceResult = run service: 'getInvoicePaymentInfoList', with: invoice.getAllFields()
- if (ServiceUtil.isError(serviceResult)) {
- return serviceResult
- }
- paymentAmount += serviceResult.invoicePaymentInfoList[0].outstandingAmount
- } else {
- return error(label('AccountingUiLabels', 'AccountingInvoicesRequiredInReadyStatus'))
- }
- }
- if (paymentAmount > 0) {
- Map serviceResult = run service: 'getPartyAccountingPreferences', with: parameters
- if (ServiceUtil.isError(serviceResult)) {
- return serviceResult
- }
- serviceResult = run service: 'createPayment', with: [paymentTypeId: 'VENDOR_PAYMENT',
- partyIdFrom: parameters.organizationPartyId,
- currencyUomId: serviceResult.partyAccountingPreference.baseCurrencyUomId,
- partyIdTo: parameters.partyId,
- statusId: 'PMNT_SENT',
- amount: paymentAmount,
- paymentMethodTypeId: parameters.paymentMethodTypeId,
- paymentMethodId: parameters.paymentMethodId,
- paymentRefNum: parameters.checkStartNumber]
- if (ServiceUtil.isError(serviceResult)) {
- return serviceResult
- }
- paymentId = serviceResult.paymentId
-
- parameters.invoices.each { GenericValue invoice ->
- if (invoice.statusId == 'INVOICE_READY') {
- serviceResult = run service: 'getInvoicePaymentInfoList', with: invoice.getAllFields()
- if (ServiceUtil.isError(serviceResult)) {
- return serviceResult
- }
- Map invoicePaymentInfo = serviceResult.invoicePaymentInfoList[0]
- if (invoicePaymentInfo.outstandingAmount > 0) {
- serviceResult = run service: 'createPaymentApplication', with: [paymentId: paymentId,
- amountApplied: invoicePaymentInfo.outstandingAmount,
- invoiceId: invoice.invoiceId]
- if (ServiceUtil.isError(serviceResult)) {
- return serviceResult
- }
- }
- }
- invoiceIds << invoice.invoiceId
- }
- }
- return success([paymentId: paymentId,
- invoiceIds: invoiceIds,
- amount: paymentAmount])
-}
-
-Map checkAndCreateBatchForValidPayments() {
- List disbursementPaymentIds = from('Payment')
- .where(EntityCondition.makeCondition('paymentId', EntityOperator.IN, parameters.paymentIds))
- .queryList()
- .stream()
- .filter { !UtilAccounting.isReceipt(it) }
- .map { it.paymentId }
- .collect()
- .toList()
- if (disbursementPaymentIds) {
- return error(label('AccountingUiLabels', 'AccountingCannotIncludeApPaymentError', [disbursementPaymentIds: disbursementPaymentIds]))
- }
- List batchPaymentIds = from('PaymentGroupMember')
- .where(EntityCondition.makeCondition('paymentId', EntityOperator.IN, parameters.paymentIds))
- .distinct()
- .getFieldList('paymentId')
- if (batchPaymentIds) {
- return error(label('AccountingUiLabels', 'AccountingPaymentsAreAlreadyBatchedError', [batchPaymentIds: batchPaymentIds]))
- }
- Map result = run service: 'createPaymentGroupAndMember', with: parameters
- return result
-}
-
-Map getPaymentRunningTotal() {
- String currencyUomId
- List paymentIds = parameters.paymentIds
- BigDecimal runningTotal = 0
- from('Payment')
- .where(EntityCondition.makeCondition('paymentId', EntityOperator.IN, paymentIds))
- .queryList()
- .each {
- runningTotal += it.amount
- }
-
- if (parameters.organizationPartyId) {
- Map serviceResult = run service: 'getPartyAccountingPreferences', with: [organizationPartyId: parameters.organizationPartyId]
- GenericValue partyAcctgPreference = serviceResult.partyAccountingPreference
- currencyUomId = partyAcctgPreference.baseCurrencyUomId ?: UtilProperties.getPropertyValue('general.properties', 'currency.uom.id.default')
- } else {
- currencyUomId = UtilProperties.getPropertyValue('general.properties', 'currency.uom.id.default')
- }
- return success(paymentRunningTotal: UtilFormatOut.formatCurrency(runningTotal, currencyUomId, locale))
-}
-
-Map createPaymentContent() {
- GenericValue newEntity = makeValue('PaymentContent', parameters)
- newEntity.fromDate = newEntity.fromDate ?: UtilDateTime.nowTimestamp()
- newEntity.create()
-
- Map result = run service: 'updateContent', with: parameters
- if (ServiceUtil.isError(result)) {
- return result
- }
-
- return success([contentId: newEntity.contentId,
- paymentId: newEntity.paymentId,
- paymentContentTypeId: newEntity.paymentContentTypeId])
-}
-
-//TODO: This can be converted into entity-auto with a seca rule for updateContent
-Map updatePaymentContent() {
- GenericValue lookedUpValue = from('PaymentContent').where(parameters).queryOne()
- if (lookedUpValue) {
- lookedUpValue.setNonPKFields(parameters)
- lookedUpValue.store()
- Map result = run service: 'updateContent', with: parameters
- if (ServiceUtil.isError(result)) {
- return result
- }
- return success()
- }
- return error('Error getting Payment Content')
-}
-
-Map massChangePaymentStatus() {
- parameters.paymentIds.each { paymentId ->
- Map result = run service: 'setPaymentStatus', with: [paymentId: paymentId,
- statusId: parameters.statusId]
- if (ServiceUtil.isError(result)) {
- return result
- }
- }
- return success()
-}
-
-Map getInvoicePaymentInfoListByDueDateOffset() {
- List filteredInvoicePaymentInfoList = []
- Timestamp asOfDate = UtilDateTime.getDayEnd(UtilDateTime.nowTimestamp(), (long) parameters.daysOffset)
- EntityCondition condition = new EntityConditionBuilder().AND {
- EQUALS(invoiceTypeId: parameters.invoiceTypeId)
- NOT_IN(statusId: ['INVOICE_CANCELLED', 'INVOICE_PAID'])
- }
- if (parameters.partyId) {
- condition = new EntityConditionBuilder().AND(condition) {
- EQUALS(partyId: parameters.partyId)
- }
- }
- if (parameters.partyIdFrom) {
- condition = new EntityConditionBuilder().AND(condition) {
- EQUALS(partyIdFrom: parameters.partyIdFrom)
- }
- }
-
- from('Invoice')
- .where(condition)
- .orderBy('invoiceDate')
- .queryList()
- .each {
- Map serviceResult = run service: 'getInvoicePaymentInfoList', with: [invoice: it]
- if (ServiceUtil.isError(serviceResult)) {
- return serviceResult
- }
- invoicePaymentInfoList = serviceResult.invoicePaymentInfoList
- if (invoicePaymentInfoList) {
- invoicePaymentInfoList.each { Map invoicePaymentInfo ->
- if (invoicePaymentInfo.outstandingAmount > 0 && invoicePaymentInfo.dueDate.before(asOfDate)) {
- filteredInvoicePaymentInfoList << invoicePaymentInfo
- }
- }
- }
- }
-
- return success(invoicePaymentInfoList: filteredInvoicePaymentInfoList)
-}
-
-Map voidPayment() {
- GenericValue payment = from('Payment').where(parameters).queryOne()
- if (!payment) {
- return error(UtilProperties.getResourceBundleMap('AccountingUiLabels', locale)?.AccountingNoPaymentsfound)
- }
- String paymentId = payment.paymentId
- Map paymentStatusCtx = [paymentId: paymentId,
- statusId: 'PMNT_VOID']
- run service: 'setPaymentStatus', with: paymentStatusCtx
- from('PaymentApplication')
- .where(paymentId: paymentId)
- .queryList()
- .each { it ->
- Map invoice = from('Invoice').where(invoiceId: it.invoiceId).queryOne()
- if (invoice.statusId == 'INVOICE_PAID') {
- run service: 'setInvoiceStatus', with: [*: invoice.getAllFields(),
- paidDate: null,
- statusId: 'INVOICE_READY']
- }
- run service: 'removePaymentApplication', with: [paymentApplicationId: it.paymentApplicationId]
- }
-
- from('AcctgTrans')
- .where(invoiceId: null,
- paymentId: paymentId)
- .queryList()
- .each { it ->
- Map result = run service: 'copyAcctgTransAndEntries', with: [fromAcctgTransId: it.acctgTransId,
- revert: 'Y']
- if (it.isPosted == 'Y') {
- run service: 'postAcctgTrans', with: [acctgTransId: result.acctgTransId]
- }
- }
- return success([finAccountTransId: payment.finAccountTransId,
- statusId: 'FINACT_TRNS_CANCELED'])
-}
-
-Map getPaymentGroupReconciliationId() {
- GenericValue paymentGroupMember = from('PaymentGroupMember')
- .where('paymentGroupId', parameters.paymentGroupId)
- .queryFirst()
- String glReconciliationId = null
- if (paymentGroupMember) {
- GenericValue payment = paymentGroupMember.getRelatedOne('Payment', false)
- GenericValue finAccountTrans = payment.getRelatedOne('FinAccountTrans', false)
- if (finAccountTrans) {
- glReconciliationId = finAccountTrans.glReconciliationId
- }
- }
- return success(glReconciliationId: glReconciliationId)
-}
-
-Map createPaymentAndApplication() {
- Map createPaymentResp = run service: 'createPayment', with: parameters
- if (ServiceUtil.isError(createPaymentResp)) {
- return createPaymentResp
- }
-
- Map createPaymentApplicationResp = run service: 'createPaymentApplication', with: [*: parameters,
- paymentId: createPaymentResp.paymentId,
- amountApplied: parameters.amount]
- if (ServiceUtil.isError(createPaymentApplicationResp)) {
- return createPaymentApplicationResp
- }
-
- return success([paymentId: createPaymentResp.paymentId,
- paymentApplicationId: createPaymentApplicationResp.paymentApplicationId])
-}
-
-Map createFinAccoutnTransFromPayment() {
- Map result = run service: 'createFinAccountTrans', with: [*: parameters,
- finAccountTransTypeId: 'WITHDRAWAL',
- partyId: parameters.organizationPartyId,
- transactionDate: UtilDateTime.nowTimestamp(),
- entryDate: UtilDateTime.nowTimestamp(),
- statusId: 'FINACT_TRNS_CREATED',
- comments: "Pay to ${parameters.partyId} for invoice Ids - ${parameters.invoiceIds}"]
-
- if (ServiceUtil.isError(result)) {
- return result
- }
- String finAccountTransId = result.finAccountTransId
- result = run service: 'updatePayment', with: [finAccountTransId: finAccountTransId,
- paymentId: parameters.paymentId]
- if (ServiceUtil.isError(result)) {
- return result
- }
- return success(finAccountTransId: finAccountTransId)
-}
-
-Map quickSendPayment() {
- Map updatePaymentResp = run service: 'updatePayment', with: parameters
- if (ServiceUtil.isError(updatePaymentResp)) {
- return updatePaymentResp
- }
-
- Map setPaymentStatusResp = run service: 'setPaymentStatus', with: [*: parameters,
- statusId: 'PMNT_SENT']
- if (ServiceUtil.isError(setPaymentStatusResp)) {
- return setPaymentStatusResp
- }
-
- return success()
-}
-
-/**
- * Service to cancel payment batch
- */
-Map cancelPaymentBatch() {
- List<GenericValue> paymentGroupMemberAndTransList = from('PmtGrpMembrPaymentAndFinAcctTrans')
- .where('paymentGroupId', parameters.paymentGroupId)
- .queryList()
-
- if (paymentGroupMemberAndTransList) {
- if (paymentGroupMemberAndTransList[0].finAccountTransStatusId == 'FINACT_TRNS_APPROVED') {
- return error(label('AccountingErrorUiLabels', 'AccountingTransactionIsAlreadyReconciled'))
- }
-
- for (GenericValue paymentGroupMember : paymentGroupMemberAndTransList) {
- Map result = run service: 'expirePaymentGroupMember', with: paymentGroupMember.getAllFields()
- if (ServiceUtil.isError(result)) {
- return result
- }
-
- GenericValue finAccountTrans = from('FinAccountTrans').where('finAccountTransId', paymentGroupMember.finAccountTransId).queryOne()
- if (finAccountTrans) {
- finAccountTrans.statusId = 'FINACT_TRNS_CANCELED'
- result = run service: 'setFinAccountTransStatus', with: [*: finAccountTrans.getAllFields(),
- statusId: 'FINACT_TRNS_CANCELED']
- if (ServiceUtil.isError(result)) {
- return result
- }
- }
- }
- }
- return success()
-}
-
-Map getPayments() {
- List payments = []
- if (parameters.paymentGroupId) {
- List paymentIds = from('PaymentGroupMember')
- .where('paymentGroupId', parameters.paymentGroupId)
- .filterByDate()
- .distinct()
- .getFieldList('paymentId')
- if (paymentIds) {
- payments = from('Payment')
- .where(EntityCondition.makeCondition('paymentId', EntityOperator.IN, paymentIds))
- .queryList()
- }
- }
- if (parameters.finAccountTransId) {
- payments = from('Payment')
- .where('finAccountTransId', parameters.finAccountTransId)
- .queryList()
- }
- return success(payments: payments)
-}
-
-Map cancelCheckRunPayments() {
- List paymentGroupMemberAndTransList = from('PmtGrpMembrPaymentAndFinAcctTrans')
- .where('paymentGroupId', parameters.paymentGroupId)
- .queryList()
- if (paymentGroupMemberAndTransList) {
- if ('FINACT_TRNS_APPROVED' != paymentGroupMemberAndTransList[0].finAccountTransStatusId) {
- for (GenericValue paymentGroupMemberAndTrans : paymentGroupMemberAndTransList) {
- GenericValue payment = from('Payment').where('paymentId', paymentGroupMemberAndTrans.paymentId).queryOne()
- Map result = run service: 'voidPayment', with: payment.getAllFields()
- if (ServiceUtil.isError(result)) {
- return result
- }
- result = run service: 'expirePaymentGroupMember', with: paymentGroupMemberAndTrans.getAllFields()
- if (ServiceUtil.isError(result)) {
- return result
- }
- }
- } else {
- return error(label('AccountingErrorUiLabels', 'AccountingCheckIsAlreadyIssued'))
- }
- }
- return success()
-}
-
-Map createPaymentGroupAndMember() {
- serviceResult = success()
- parameters.fromDate = parameters.fromDate ?: UtilDateTime. nowTimestamp()
- parameters.paymentGroupName = parameters.paymentGroupName ?: 'Payment Group Name'
-
- Map result = run service: 'createPaymentGroup', with: parameters
- if (ServiceUtil.isError(result)) {
- return result
- }
- String paymentGroupId = result.paymentGroupId
-
- parameters.paymentIds.each { paymentId ->
- result = run service: 'createPaymentGroupMember', with: [paymentGroupId: paymentGroupId,
- fromDate: parameters.fromDate,
- paymentId: paymentId]
- if (ServiceUtil.isError(result)) {
- return result
- }
- }
- return success(paymentGroupId: paymentGroupId)
-}
-
-Map createPaymentAndPaymentGroupForInvoices() {
- Map result
- GenericValue paymentMethod = from('PaymentMethod').where('paymentMethodId', parameters.paymentMethodId).queryOne()
-
- if (paymentMethod) {
- GenericValue finAccount = from('FinAccount').where('finAccountId', paymentMethod.finAccountId).queryOne()
- if (finAccount.statusId == 'FNACT_MANFROZEN') {
- return error(label('AccountingErrorUiLabels', 'AccountingFinAccountInactiveStatusError'))
- } else if (finAccount.statusId == 'FNACT_CANCELLED') {
- return error(label('AccountingErrorUiLabels', 'AccountingFinAccountStatusNotValidError'))
- }
- }
- Map partyInvoices = [:]
- parameters.invoiceIds.each { invoiceId ->
- GenericValue invoice = from('Invoice').where('invoiceId', invoiceId).queryOne()
- UtilMisc.addToListInMap(invoice, partyInvoices, invoice.partyIdFrom)
- }
- List paymentIds = []
- partyInvoices.each { partyId, invoice ->
- if (parameters.checkStartNumber) {
- parameters.checkStartNumber = parameters.checkStartNumber + 1
- }
- result = run service: 'createPaymentAndApplicationForParty', with: [*: parameters,
- paymentMethodTypeId: paymentMethod.paymentMethodTypeId,
- finAccountId: paymentMethod.finAccountId,
- partyId: partyId,
- invoices: invoice]
- paymentIds << result.paymentId
- }
- if (paymentIds) {
- result = run service: 'createPaymentGroupAndMember',
- with: [paymentIds: paymentIds,
- paymentGroupTypeId: 'CHECK_RUN',
- paymentGroupName: "Payment group for Check Run(InvoiceIds-${parameters.invoiceIds})"]
- paymentGroupId = result.paymentGroupId
- }
- if (!result.paymentGroupId) {
- return error(label('AccountingUiLabels', 'AccountingNoInvoicesReadyOrOutstandingAmountZero'))
- }
- return result
-}
-
-Map createPaymentFromOrder() {
- GenericValue orderHeader = from('OrderHeader').where(parameters).queryOne()
- if (orderHeader) {
- if (orderHeader.orderTypeId == 'PURCHASE_ORDER') {
- String purchaseAutoCreate = UtilProperties.getPropertyValue('accounting', 'accounting.payment.purchaseorder.autocreate', 'Y')
- if (purchaseAutoCreate != 'Y') {
- return error('payment not created from approved order because config' +
- ' (accounting.payment.salesorder.autocreate) is not set to Y (accounting.properties)')
- }
- } else if (orderHeader.orderTypeId == 'SALES_ORDER') {
- String salesAutoCreate = UtilProperties.getPropertyValue('accounting', 'accounting.payment.salesorder.autocreate', 'Y')
- if (salesAutoCreate != 'Y') {
- return error('payment not created from approved order because config' +
- ' (accounting.payment.salesorder.autocreate) is not set to Y (accounting.properties)')
- }
- }
-
- /* check if orderPaymentPreference with payment already exist, if yes do not re-create */
- if (from('OrderPaymentPrefAndPayment')
- .where([EntityCondition.makeCondition('orderId', orderHeader.orderId),
- EntityCondition.makeCondition('statusId', EntityOperator.NOT_EQUAL, 'PAYMENT_CANCELLED')])
- .queryCount() > 0) {
- return failure("Payment not created for order ${orderHeader.orderId}, at least a single payment already exists")
- }
-
- GenericValue orderRoleTo = from('OrderRole')
- .where(orderId: orderHeader.orderId,
- roleTypeId: 'BILL_FROM_VENDOR')
- .queryFirst()
- GenericValue orderRoleFrom = from('OrderRole')
- .where(orderId: orderHeader.orderId,
- roleTypeId: 'BILL_TO_CUSTOMER')
- .queryFirst()
-
- GenericValue agreement
- String organizationPartyId
- if (orderHeader.orderTypeId == 'PURCHASE_ORDER') {
- agreement = from('Agreement')
- .where(partyIdFrom: orderRoleFrom.partyId,
- partyIdTo: orderRoleTo.partyId,
- agreementTypeId: 'PURCHASE_AGREEMENT')
- .filterByDate()
- .queryFirst()
- parameters.paymentTypeId = 'VENDOR_PAYMENT'
- organizationPartyId = orderRoleFrom.partyId
- } else {
- agreement = from('Agreement')
- .where(partyIdFrom: orderRoleFrom.partyId,
- partyIdTo: orderRoleTo.partyId,
- agreementTypeId: 'SALES_AGREEMENT')
- .filterByDate()
- .queryFirst()
- parameters.paymentTypeId = 'CUSTOMER_PAYMENT'
- organizationPartyId = orderRoleTo.partyId
- }
-
- if (agreement) {
- GenericValue orderTerm = from('OrderTerm')
- .where(orderId: orderHeader.orderId,
- termTypeId: 'FIN_PAYMENT_TERM')
- .queryFirst()
- if (orderTerm && orderTerm.termDays) {
- parameters.effectiveDate = UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), orderTerm.termDays)
- }
- }
- parameters.effectiveDate = parameters.effectiveDate ?: UtilDateTime.nowTimestamp()
-
- /* check currency and when required use invoice currency rate or convert when invoice not available */
-
- Map result = run service: 'getPartyAccountingPreferences', with: [organizationPartyId: organizationPartyId]
- GenericValue partyAcctgPreference = result.partyAccountingPreference
- if (partyAcctgPreference.baseCurrencyUomId &&
- orderHeader.currencyUom == partyAcctgPreference.baseCurrencyUomId) {
- parameters.currencyUomId = orderHeader.currencyUom
- parameters.amount = orderHeader.grandTotal
-
- /* get conversion rate from related invoice when exists */
- Map convertUomInMap = [originalValue: orderHeader.grandTotal,
- uomId: orderHeader.currencyUom,
- uomIdTo: partyAcctgPreference.baseCurrencyUomId]
- List<GenericValue> invoices = from('OrderItemBillingAndInvoiceAndItem')
- .where(orderId: orderHeader.orderId)
- .queryList()
- if (invoices) {
- GenericValue invoice = from('Invoice').where('invoiceId', invoices[0].invoiceId).queryOne()
- convertUomInMap.asOfDate = invoice.invoiceDate
- }
- logInfo('convertUomInMap = ' + convertUomInMap)
-
- result = run service: 'convertUom', with: convertUomInMap
- parameters.amount = result.convertedValue
-
- parameters.actualCurrencyAmount = orderHeader.grandTotal
- parameters.actualCurrencyUomId = orderHeader.currencyUom
- parameters.currencyUomId = partyAcctgPreference.baseCurrencyUomId
- } else {
- parameters.currencyUomId = orderHeader.currencyUom
- parameters.amount = orderHeader.grandTotal
- }
-
- parameters.partyIdFrom = orderRoleFrom.partyId
- parameters.partyIdTo = orderRoleTo.partyId
- parameters.paymentMethodTypeId = 'COMPANY_ACCOUNT'
- parameters.statusId = 'PMNT_NOT_PAID'
-
- result = run service: 'createPayment', with: parameters
- parameters.paymentId = result.paymentId
-
- parameters.orderId = orderHeader.orderId
- parameters.maxAmount = orderHeader.grandTotal
-
- result = run service: 'createOrderPaymentPreference', with: parameters
- parameters.paymentPreferenceId = result.orderPaymentPreferenceId
-
- result = run service: 'updatePayment', with: parameters
- result.paymentId = parameters.paymentId
- logInfo('payment ' + parameters.paymentId + ' with the not-paid status automatically created from order: '
- + parameters.orderId + ' (can be disabled in accounting.properties)')
-
- return result
- }
-}
-
-Map createPaymentApplication() {
- // Create a Payment Application
- if (!parameters.invoiceId && !parameters.billingAccountId && !parameters.taxAuthGeoId && !parameters.toPaymentId) {
- return error(label('AccountingUiLabels', 'AccountingPaymentApplicationParameterMissing'))
- }
- GenericValue paymentAppl = makeValue('PaymentApplication', parameters)
-
- GenericValue payment = from('Payment').where('paymentId', parameters.paymentId).queryOne()
- if (!payment) {
- return error(label('AccountingUiLabels', 'AccountingPaymentApplicationParameterMissing'))
- }
-
- BigDecimal notAppliedPayment = PaymentWorker.getPaymentNotApplied(payment)
-
- if (parameters.invoiceId) {
- // get the invoice and do some further validation against it
- GenericValue invoice = from('Invoice').where('invoiceId', parameters.invoiceId).queryOne()
- // check the currencies if they are compatible
- if (invoice.currencyUomId != payment.currencyUomId && invoice.currencyUomId != payment.actualCurrencyUomId) {
- return error(label('AccountingUiLabels', 'AccountingCurrenciesOfInvoiceAndPaymentNotCompatible'))
- }
- if (invoice.currencyUomId != payment.currencyUomId && invoice.currencyUomId == payment.actualCurrencyUomId) {
- // if required get the payment amount in foreign currency (local we already have)
- notAppliedPayment = PaymentWorker.getPaymentNotApplied(payment, true)
- }
- // get the amount that has not been applied yet for the invoice (outstanding amount)
- BigDecimal notAppliedInvoice = InvoiceWorker.getInvoiceNotApplied(invoice)
- paymentAppl.amountApplied = notAppliedInvoice <= notAppliedPayment
- ? notAppliedInvoice : notAppliedPayment
-
- if (invoice.billingAccountId) {
- paymentAppl.billingAccountId = invoice.billingAccountId
- }
- }
-
- if (parameters.toPaymentId) {
- // get the to payment and check the parent types are compatible
- GenericValue toPayment = from('Payment').where('paymentId', parameters.toPaymentId).queryOne()
- // when amount not provided use the the lowest value available
- if (!parameters.amountApplied) {
- notAppliedPayment = PaymentWorker.getPaymentNotApplied(payment)
- BigDecimal notAppliedToPayment = PaymentWorker.getPaymentNotApplied(toPayment)
- paymentAppl.amountApplied = notAppliedPayment < notAppliedToPayment
- ? notAppliedPayment : notAppliedToPayment
- }
- }
-
- if (!paymentAppl.amountApplied &&
- (parameters.billingAccountId || parameters.taxAuthGeoId)) {
- paymentAppl.amountApplied = notAppliedPayment
- }
- paymentAppl.paymentApplicationId = delegator.getNextSeqId('PaymentApplication')
- paymentAppl.create()
-
- return success([amountApplied: paymentAppl.amountApplied,
- paymentApplicationId: paymentAppl.paymentApplicationId,
- paymentTypeId: payment.paymentTypeId])
-}
-
-Map setPaymentStatus() {
- GenericValue payment = from('Payment').where('paymentId', parameters.paymentId).queryOne()
- if (!payment) {
- return error("No payment found with ID ${parameters.paymentId}")
- }
- String oldStatusId = payment.statusId
- GenericValue statusItem = from('StatusItem').where('statusId', parameters.statusId).cache().queryOne()
- if (!statusItem) {
- return error("No status found with status ID ${parameters.statusId}")
- }
-
- if (oldStatusId != parameters.statusId) {
- GenericValue statusChange = from('StatusValidChange').where('statusId', oldStatusId, 'statusIdTo', parameters.statusId).cache().queryOne()
- if (! statusChange) {
- return error(label('CommonUiLabels', 'CommonErrorNoStatusValidChange'))
- }
-
- // payment method is mandatory when set to sent or received
- if (['PMNT_RECEIVED', 'PMNT_SENT'].contains(parameters.statusId) && !payment.paymentMethodId) {
- return failure(label('AccountingUiLabels', 'AccountingMissingPaymentMethod', [statusItem: statusItem]))
- }
-
- // check if the payment fully applied when set to confirmed
- if (parameters.statusId == 'PMNT_CONFIRMED' &&
- PaymentWorker.getPaymentNotApplied(payment) != 0) {
- return failure(label('AccountingUiLabels', 'AccountingPSNotConfirmedNotFullyApplied'))
- }
- }
-
- // if new status is cancelled delete existing payment applications
- if (parameters.statusId == 'PMNT_CANCELLED') {
- from('PaymentApplication')
- .where(paymentId: payment.paymentId)
- .queryList()
- .each {
- run service: 'removePaymentApplication', with: [paymentApplicationId: it.paymentApplicationId]
- }
-
- // if new status is cancelled and the payment is associated to an OrderPaymentPreference, update the status of that record too
- GenericValue orderPayPref = payment.getRelatedOne('OrderPaymentPreference', false)
- if (orderPayPref) {
- run service: 'updateOrderPaymentPreference', with: [orderPaymentPreferenceId: orderPayPref.orderPaymentPreferenceId,
- statusId: 'PAYMENT_CANCELLED']
- }
- }
-
- // everything ok, so now change the status field
- payment.statusId = parameters.statusId
- payment.store()
- return success(oldStatusId: oldStatusId)
-}
-
-Map createMatchingPaymentApplication() {
- String autoCreate = EntityUtilProperties.getPropertyValue('accounting', 'accounting.payment.application.autocreate', 'Y', delegator)
- if ('Y' != autoCreate) {
- logInfo('payment application not automatically created because config is not set to Y')
- return success()
- }
-
- Map createPaymentApplicationCtx = [:]
- if (parameters.invoiceId) {
- GenericValue invoice = from('Invoice').where('invoiceId', parameters.invoiceId).queryOne()
- if (invoice) {
- BigDecimal invoiceTotal = InvoiceWorker.getInvoiceTotal(invoice)
-
- Map isInvoiceInForeignCurrencyResp = run service: 'isInvoiceInForeignCurrency', with: [invoiceId: invoice.invoiceId]
- if (ServiceUtil.isError(isInvoiceInForeignCurrencyResp)) {
- return isInvoiceInForeignCurrencyResp
- }
-
- EntityConditionBuilder exprBldr = new EntityConditionBuilder()
- EntityCondition expr = exprBldr.AND {
- NOT_EQUAL(statusId: 'PMNT_CONFIRMED')
- EQUALS(partyIdFrom: invoice.partyId)
- EQUALS(partyIdTo: invoice.partyIdFrom)
- }
- if (isInvoiceInForeignCurrencyResp.isForeign) {
- expr = exprBldr.AND(expr) {
- EQUALS(actualCurrencyAmount: invoiceTotal)
- EQUALS(actualCurrencyUomId: invoice.currencyUomId)
- }
- } else {
- expr = exprBldr.AND(expr) {
- EQUALS(amount: invoiceTotal)
- EQUALS(currencyUomId: invoice.currencyUomId)
- }
- }
-
- GenericValue payment = from('Payment')
- .where(expr)
- .orderBy('effectiveDate')
- .queryFirst()
-
- if (payment && from('PaymentApplication')
- .where('paymentId', payment.paymentId)
- .queryCount() == 0) {
- createPaymentApplicationCtx.paymentId = payment.paymentId
- createPaymentApplicationCtx.invoiceId = parameters.invoiceId
- createPaymentApplicationCtx.amountApplied = isInvoiceInForeignCurrencyResp.isForeign
- ? payment.actualCurrencyAmount : payment.amount
- }
- }
- }
-
- if (parameters.paymentId) {
- GenericValue payment = from('Payment').where(paymentId: parameters.paymentId).queryOne()
-
- if (payment) {
- EntityCondition expr = new EntityConditionBuilder().AND {
- NOT_IN(statusId: ['INVOICE_READY', 'INVOICE_PAID', 'INVOICE_CANCELLED', 'INVOICE_WRITEOFF'])
- EQUALS(partyIdFrom: payment.partyIdTo)
- EQUALS(partyId: payment.partyIdFrom)
- }
-
- List invoices = from('Invoice')
- .where(expr)
- .orderBy('invoiceDate')
- .queryList()
- String invoiceId
- BigDecimal amountApplied
- for (GenericValue invoice: invoices) {
- boolean isPurchaseInvoice = EntityTypeUtil.hasParentType(delegator, 'InvoiceType', 'invoiceTypeId', invoice.invoiceTypeId,
- 'parentTypeId', 'PURCHASE_INVOICE')
- boolean isSalesInvoice = EntityTypeUtil.hasParentType(delegator, 'InvoiceType', 'invoiceTypeId', invoice.invoiceTypeId,
- 'parentTypeId', 'SALES_INVOICE')
-
- if (isPurchaseInvoice || isSalesInvoice) {
- BigDecimal invoiceTotal = InvoiceWorker.getInvoiceTotal(invoice)
-
- Map isInvoiceInForeignCurrencyResp = run service: 'isInvoiceInForeignCurrency', with: [invoiceId: invoice.invoiceId]
- if (ServiceUtil.isError(isInvoiceInForeignCurrencyResp)) {
- return isInvoiceInForeignCurrencyResp
- }
-
- if (isInvoiceInForeignCurrencyResp.isForeign
- && invoiceTotal == payment.actualCurrencyAmount
- && invoice.currencyUomId == payment.actualCurrencyUomId) {
- invoiceId = invoice.invoiceId
- amountApplied = payment.actualCurrencyAmount
- } else if (invoiceTotal == payment.amount && invoice.currencyUomId == payment.currencyUomId) {
- invoiceId = invoice.invoiceId
- amountApplied = payment.amount
- }
- }
- }
-
- if (invoiceId) {
- if (from('PaymentApplication')
- .where(invoiceId: invoiceId)
- .queryCount()) {
- createPaymentApplicationCtx.paymentId = parameters.paymentId
- createPaymentApplicationCtx.invoiceId = invoiceId
- createPaymentApplicationCtx.amountApplied = amountApplied
- }
- }
- }
- }
-
- if (createPaymentApplicationCtx.paymentId &&
- createPaymentApplicationCtx.invoiceId) {
- Map createPaymentApplicationResp = run service: 'createPaymentApplication', with: createPaymentApplicationCtx
- if (ServiceUtil.isError(createPaymentApplicationResp)) {
- return createPaymentApplicationResp
- }
-
- logInfo("payment application automatically created between invoiceId: $createPaymentApplicationCtx.invoiceId}" +
- " and paymentId: ${createPaymentApplicationCtx.paymentId} for" +
- " the amount: ${createPaymentApplicationCtx.amountApplied} (can be disabled in accounting.properties)")
- }
- return success()
-}
diff --git a/applications/accounting/groovyScripts/payment/PrintChecks.groovy b/applications/accounting/groovyScripts/payment/PrintChecks.groovy
deleted file mode 100644
index 75b154815a..0000000000
--- a/applications/accounting/groovyScripts/payment/PrintChecks.groovy
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.base.util.UtilHttp
-import org.apache.ofbiz.base.util.UtilNumber
-
-// rounding mode
-decimals = UtilNumber.getBigDecimalScale('invoice.decimals')
-rounding = UtilNumber.getBigDecimalRoundingMode('invoice.rounding')
-context.decimals = decimals
-context.rounding = rounding
-
-// list of payments
-payments = []
-
-// first ensure ability to print
-security = request.getAttribute('security')
-context.put('security', security)
-if (!security.hasEntityPermission('ACCOUNTING', '_PRINT_CHECKS', session)) {
- context.payments = payments // if no permission, just pass an empty list for now
- return
-}
-
-// in the case of a single payment, the paymentId will be supplied
-paymentId = context.paymentId
-if (paymentId) {
- payment = from('Payment').where('paymentId', paymentId).queryOne()
- if (payment) {
- payments.add(payment)
- }
- context.payments = payments
- return
-}
-
-// in the case of a multi form, parse the multi data and get all of the selected payments
-selected = UtilHttp.parseMultiFormData(parameters)
-selected.each { row ->
- payment = from('Payment').where('paymentId', row.paymentId).queryOne()
- if (payment) {
- payments.add(payment)
- }
-}
-paymentGroupMembers = from('PaymentGroupMember').where('paymentGroupId', parameters.paymentGroupId).filterByDate().queryList()
-//in the case of a multiple payments, paymentId List is supplied.
-paymentGroupMembers.each { paymentGroupMember ->
- payments.add(paymentGroupMember.getRelatedOne('Payment', false))
-}
-context.payments = payments
diff --git a/applications/accounting/groovyScripts/period/EditCustomTimePeriod.groovy b/applications/accounting/groovyScripts/period/EditCustomTimePeriod.groovy
deleted file mode 100644
index 1a5cbdc236..0000000000
--- a/applications/accounting/groovyScripts/period/EditCustomTimePeriod.groovy
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-findOrganizationPartyId = parameters.findOrganizationPartyId
-if (findOrganizationPartyId) {
- context.findOrganizationPartyId = findOrganizationPartyId
-}
-
-currentCustomTimePeriodId = parameters.currentCustomTimePeriodId
-if (currentCustomTimePeriodId) {
- context.currentCustomTimePeriodId = currentCustomTimePeriodId
-}
-
-currentCustomTimePeriod = currentCustomTimePeriodId ? from('CustomTimePeriod')
- .where('customTimePeriodId', currentCustomTimePeriodId).queryOne() : null
-if (currentCustomTimePeriod) {
- context.currentCustomTimePeriod = currentCustomTimePeriod
-}
-
-currentPeriodType = currentCustomTimePeriod ? currentCustomTimePeriod.getRelatedOne('PeriodType', true) : null
-if (currentPeriodType) {
- context.currentPeriodType = currentPeriodType
-}
-
-findMap = [ : ]
-if (findOrganizationPartyId) {
- findMap.organizationPartyId = findOrganizationPartyId
-}
-if (currentCustomTimePeriodId) {
- findMap.parentPeriodId = currentCustomTimePeriodId
-}
-
-customTimePeriods = from('CustomTimePeriod').where(findMap).orderBy(['periodTypeId', 'periodNum', 'fromDate']).queryList()
-context.customTimePeriods = customTimePeriods
-
-allCustomTimePeriods = from('CustomTimePeriod')
- .orderBy(['organizationPartyId', 'parentPeriodId', 'periodTypeId', 'periodNum', 'fromDate']).queryList()
-context.allCustomTimePeriods = allCustomTimePeriods
-
-periodTypes = from('PeriodType').orderBy('description').cache(true).queryList()
-context.periodTypes = periodTypes
-
-String newPeriodTypeId
-
-switch (currentCustomTimePeriod?.periodTypeId) {
- case 'FISCAL_YEAR':
- newPeriodTypeId = 'FISCAL_QUARTER'
- break
- case 'FISCAL_QUARTER':
- newPeriodTypeId = 'FISCAL_MONTH'
- break
- case 'FISCAL_MONTH':
- newPeriodTypeId = 'FISCAL_WEEK'
- break
- case 'FISCAL_BIWEEK':
- newPeriodTypeId = 'FISCAL_WEEK'
- break
- case 'FISCAL_WEEK':
- newPeriodTypeId = ''
- break
- default:
- newPeriodTypeId = 'FISCAL_YEAR'
- break
-}
-
-context.newPeriodTypeId = newPeriodTypeId
diff --git a/applications/accounting/groovyScripts/rate/RateServices.groovy b/applications/accounting/groovyScripts/rate/RateServices.groovy
deleted file mode 100644
index 14689a7ed1..0000000000
--- a/applications/accounting/groovyScripts/rate/RateServices.groovy
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * 'License'); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilProperties
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.entity.util.EntityUtil
-import org.apache.ofbiz.service.ServiceUtil
-
-import java.sql.Timestamp
-
-/**
- * Service to create a rate amount value, if a existing value is present expire it before
- */
-Map updateRateAmount() {
- GenericValue newEntity = delegator.makeValidValue('RateAmount', parameters)
- newEntity.rateCurrencyUomId = newEntity.rateCurrencyUomId ?: UtilProperties.getPropertyValue('general.properties', 'currency.uom.id.default')
- newEntity.fromDate = newEntity.fromDate ?: UtilDateTime.nowTimestamp()
- newEntity.thruDate = null
-
- //Check if the entry is already exist with a different rate else expire the older to create the new one
- boolean updating = false
- GenericValue rateAmountLookedUpValue = from('RateAmount').where('rateTypeId', newEntity.rateTypeId,
- 'emplPositionTypeId', newEntity.emplPositionTypeId,
- 'rateCurrencyUomId', newEntity.rateCurrencyUomId,
- 'workEffortId', newEntity.workEffortId,
- 'periodTypeId', newEntity.periodTypeId,
- 'partyId', newEntity.partyId).filterByDate().queryFirst()
- if (rateAmountLookedUpValue) {
- updating = (rateAmountLookedUpValue.fromDate == newEntity.fromDate)
- if (rateAmountLookedUpValue.rateAmount != rateAmount) {
- result = run service: 'expireRateAmount', with: rateAmountLookedUpValue.getAllFields()
- if (ServiceUtil.isError(result)) {
- return result
- }
- } else {
- return error(UtilProperties.getMessage('AccountingErrorUiLabels', 'AccountingUpdateRateAmountAlreadyExist', locale))
- }
- }
- updating ? newEntity.store() : newEntity.create()
- return success()
-}
-
-/**
- * Service to expire a rate amount value
- */
-Map expireRateAmount() {
- GenericValue lookedUpValue = delegator.makeValidValue('RateAmount', parameters)
- lookedUpValue.rateCurrencyUomId = lookedUpValue.rateCurrencyUomId ?: UtilProperties.getPropertyValue('general.properties',
- 'currency.uom.id.default')
- lookedUpValue = from('RateAmount').where(lookedUpValue).queryOne()
- if (lookedUpValue) {
- Timestamp previousDay = UtilDateTime.adjustTimestamp(UtilDateTime.nowTimestamp(), 5, -1)
- lookedUpValue.thruDate = UtilDateTime.getDayEnd(previousDay)
- lookedUpValue.store()
- } else {
- return error(UtilProperties.getMessage('AccountingErrorUiLabels', 'AccountingDeleteRateAmount', locale))
- }
- return success()
-}
-/**
- * Information to update the specific customer code after change service deleteRateAmount to expireRateAmount
- */
-Map deleteRateAmount() {
- return error('delete rate amount isn\'t possible, please update your code with service name "expireRateAmount" instead "deleteRateAmount"')
-}
-
-Map updatePartyRate() {
- List<GenericValue> partyRates = from('PartyRate').where([partyId: partyId, rateTypeId: rateTypeId]).queryList()
- if (partyRates) {
- GenericValue partyRate = EntityUtil.getFirst(partyRates)
- partyRate.thruDate = UtilDateTime.nowTimestamp()
- }
- GenericValue newEntity = delegator.makeValidValue('PartyRate', parameters)
- newEntity.fromDate = newEntity.fromDate ?: UtilDateTime.nowTimestamp()
- newEntity.create()
-
- //check other default rate to desactive them
- if (newEntity.defaultRate == 'Y') {
- partyRates = from('PartyRate').where([partyId: partyId, defaultRate: 'Y']).queryList()
- partyRates.each { partyDefaultRate ->
- partyDefaultRate.defaultRate = 'N'
- partyDefaultRate.store()
- }
- }
- if (parameters.rateAmount) {
- result = run service: 'updateRateAmount', with: parameters
- if (ServiceUtil.isError(result)) {
- return result
- }
- }
- return success()
-}
-Map deletePartyRate() {
- return error('delete party rate isn\'t possible, please update your code with service name "expirePartyRate" instead "deletePartyRate"')
-}
-Map expirePartyRate() {
- GenericValue lookedUpValue = from('PartyRate').where(parameters).queryOne()
- if (lookedUpValue) {
- lookedUpValue.thruDate = UtilDateTime.nowTimestamp()
- lookedUpValue.store()
-
- //expire related rate amount
- if (parameters.rateAmountFromDate) {
- parameters.fromDate = parameters.rateAmountFromDate
- result = run service: 'expireRateAmount', with: parameters
- if (ServiceUtil.isError(result)) {
- return result
- }
- }
- }
- return success()
-}
-
-// Get the applicable rate amount value
-Map getRateAmount() {
- /* Search for the applicable rate from most specific to most general in the RateAmount entity
- Defaults for periodTypeId is per hour and default currency is the currency in general.properties
- The order is:
- 1. for specific rateTypeId, workEffortId (workEffort)
- 2. for specific rateTypeId, partyId (party)
- 3. for specific rateTypeId, emplPositionTypeId (emplPositionType)
- 4. for specific rateTypeId (rateType)
-
- Then, the results are filtered to improve the result. If you pass a workEffortId and a partyId,
- the service will first search the list of all the rateAmount with the specified workEffortId. Then, if
- there is at least one rateAmount with same partyId than the one in the parameter in the list, the list will
- be reduced to those entries.
- At the end, the first record of the list is chosen.
-
- For a easier debugging time, there is a log triggered when no records are found for the input. This log
- shows up when there are rateAmounts corresponding to the input parameters without the rateCurrencyUomId and
- the periodTypeId.*/
- String serviceName = null
- String level = 'rateTypeId'
- if (parameters.workEffortId && parameters.workEffortId != '_NA_') {
- // workeffort level
- level = 'workEffortId'
- serviceName = 'getRatesAmountsFromWorkEffortId'
- } else if (parameters.partyId && parameters.partyId != '_NA_') {
- // party level
- level = 'partyId'
- serviceName = 'getRatesAmountsFromPartyId'
- } else if (parameters.emplPositionTypeId && parameters.emplPositionTypeId != '_NA_') {
- // party level
- level = 'emplPositionTypeId'
- serviceName = 'getRatesAmountsFromEmplPositionTypeId'
- }
- if (serviceName) {
- Map serviceContextMap = new HashMap<>(parameters)
- serviceContextMap.rateCurrencyUomId = serviceContextMap.rateCurrencyUomId ?: UtilProperties.getPropertyValue('general.properties',
- 'currency.uom.id.default', 'USD')
- Map result = run service: serviceName, with: serviceContextMap
- serviceContextMap.ratesList = result.ratesList
- result = run service: 'filterRateAmountList', with: serviceContextMap
- ratesList = result.filteredRatesList
- }
-
- if (!ratesList) {
- ratesList = from('RateAmount').where([rateTypeId: parameters.rateTypeId]).queryList()
- Map serviceContextMap = new HashMap<>(parameters)
- serviceContextMap.ratesList = ratesList
- Map result = run service: 'filterRateAmountList', with: serviceContextMap
- ratesList = EntityUtil.filterByDate(result.filteredRatesList)
- }
-
- if (!ratesList) {
- rateType = from('RateAmount').where(parameters).queryOne()
- logError('A valid rate amount could not be found for rateType: ' + rateType?.description)
- }
-
- // We narrowed as much as we could the result, now returning the first record of the list
- Map result = success()
- if (ratesList) {
- rateAmount = ratesList[0]
- rateAmount.rateAmount = rateAmount.rateAmount ?: BigDecimal.ZERO
- result.rateAmount = rateAmount.rateAmount
- result.periodTypeId = rateAmount.periodTypeId
- result.rateCurrencyUomId = rateAmount.rateCurrencyUomId
- result.level = level
- result.fromDate = rateAmount.fromDate
- }
- return result
-}
-
-//Generic fonction to resolve a rate amount from a pk field
-Map getRatesAmountsFrom(String field) {
- String entityName = null
- switch (field) {
- case 'workEffortId':
- entityName = 'WorkEffort'
- break
- case 'partyId':
- entityName = 'Party'
- break
- case 'emplPositionTypeId':
- entityName = 'EmplPositionType'
- break
- }
-
- Map condition = [rateTypeId: parameters.rateTypeId,
- periodTypeId: parameters.periodTypeId,
- rateCurrencyUomId: parameters.rateCurrencyUomId]
- condition.put(field, parameters.get(field))
- List ratesList = from('RateAmount').where(condition).filterByDate().queryList()
- if (!ratesList) {
- GenericValue periodType = from('PeriodType').where(parameters).queryOne()
- GenericValue rateType = from('RateType').where(parameters).queryOne()
- GenericValue partyNameView = from('PartyNameView').where(parameters).queryOne()
- logError('A valid rate entry could be found for rateType:' + rateType.description + ', ' + entityName + ':' + parameters.get(field)
- + ', party: ' + partyNameView.lastName + partyNameView.middleName + partyNameView.firstName + partyNameView.groupName
- + ' However.....not for the period:' + periodType.description + ' and currency:' + parameters.rateCurrencyUomId)
- }
- Map result = success()
- result.ratesList = ratesList
- return result
-}
-// Get all the rateAmount for a given workEffortId
-Map getRatesAmountsFromWorkEffortId() {
- return getRatesAmountsFrom('workEffortId')
-}
-// Get all the rateAmount for a given partyId
-Map getRatesAmountsFromPartyId() {
- return getRatesAmountsFrom('partyId')
-}
-// Get all the rateAmount for a given emplPositionTypeId
-Map getRatesAmountsFromEmplPositionTypeId() {
- return getRatesAmountsFrom('emplPositionTypeId')
-}
-
-//Filter a list of rateAmount. The result is the most heavily-filtered non-empty list
-Map filterRateAmountList() {
- if (!parameters.ratesList) {
- logWarning('The list parameters.ratesList was empty, not processing any further')
- return success()
- }
- //Check if there is a more specific rate
- Map filterMap = [:]
- if (parameters.workEffortId) {
- filterMap.workEffortId = parameters.workEffortId
- }
- if (parameters.partyId) {
- filterMap.partyId = parameters.partyId
- }
- if (parameters.emplPositionTypeId) {
- filterMap.emplPositionTypeId = parameters.emplPositionTypeId
- }
- if (parameters.rateTypeId) {
- filterMap.rateTypeId = parameters.rateTypeId
- }
- List tempRatesFilteredList = EntityUtil.filterByAnd(parameters.ratesList, filterMap)
- List ratesList = []
- if (tempRatesFilteredList) {
- ratesList = tempRatesFilteredList
- }
- Map result = success()
- result.filteredRatesList = ratesList
- return result
-}
diff --git a/applications/accounting/groovyScripts/reports/BalanceSheet.groovy b/applications/accounting/groovyScripts/reports/BalanceSheet.groovy
deleted file mode 100644
index d3c3b071de..0000000000
--- a/applications/accounting/groovyScripts/reports/BalanceSheet.groovy
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.accounting.util.UtilAccounting
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilMisc
-import org.apache.ofbiz.base.util.UtilProperties
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityExpr
-import org.apache.ofbiz.entity.condition.EntityOperator
-import org.apache.ofbiz.party.party.PartyWorker
-
-import java.sql.Timestamp
-
-uiLabelMap = UtilProperties.getResourceBundleMap('AccountingUiLabels', locale)
-
-thruDate = thruDate ?: UtilDateTime.nowTimestamp()
-if (!glFiscalTypeId) {
- return
-}
-organizationPartyId = null
-if (context.organizationPartyId) {
- organizationPartyId = context.organizationPartyId
-} else {
- organizationPartyId = parameters.get('ApplicationDecorator|organizationPartyId')
-}
-// Setup the divisions for which the report is executed
-List partyIds = PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP')
-partyIds.add(organizationPartyId)
-
-// Get the group of account classes that will be used to position accounts in the proper section of the financial statement
-GenericValue assetGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'ASSET').cache(true).queryOne()
-List assetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(assetGlAccountClass)
-GenericValue contraAssetGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'CONTRA_ASSET').cache(true).queryOne()
-List contraAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(contraAssetGlAccountClass)
-GenericValue liabilityGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'LIABILITY').cache(true).queryOne()
-List liabilityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(liabilityGlAccountClass)
-GenericValue equityGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'EQUITY').cache(true).queryOne()
-List equityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(equityGlAccountClass)
-GenericValue currentAssetGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'CURRENT_ASSET').cache(true).queryOne()
-List currentAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(currentAssetGlAccountClass)
-GenericValue longtermAssetGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'LONGTERM_ASSET').cache(true).queryOne()
-List longtermAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(longtermAssetGlAccountClass)
-GenericValue currentLiabilityGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'CURRENT_LIABILITY').cache(true).queryOne()
-List currentLiabilityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(currentLiabilityGlAccountClass)
-
-// Find the last closed time period to get the fromDate for the transactions in the current period and the ending balances of the last closed period
-Map lastClosedTimePeriodResult = runService('findLastClosedDate',
- ['organizationPartyId': organizationPartyId, 'findDate': thruDate, 'userLogin': userLogin])
-Timestamp fromDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate
-if (!fromDate) {
- return
-}
-
-GenericValue lastClosedTimePeriod = (GenericValue)lastClosedTimePeriodResult.lastClosedTimePeriod
-
-class AccountBalance {
-
- String glAccountId
- String accountCode
- String accountName
- BigDecimal balance
- Map asMap() {
- [glAccountId: glAccountId, accountCode: accountCode, accountName: accountName, balance: balance]
- }
-
-}
-
-/**
- * Closure to retrieve a map of AccountBalances for the organization's GL Account which were active during the most
- * recently closed time period - i.e. those accounts for which GlAccountHistory exists.
- *
- * AccountBalances are returned for those accounts which match the accountClassIds parameter.
- *
- * @param accountClassIds The set of GL Account Class IDs to return Ending Balances for.
- *
- * @return Map of GL Account IDs to AccountBalances for the lastClosedTimePeriod, or an empty map if
- * lastClosedTimePeriod is null
- */
-Closure<Map<String, AccountBalance>> getLastPeriodClosingBalancesForAccountClassIds = { List<String> accountClassIds ->
- Map<String, AccountBalance> retVal = [:]
-
- if (lastClosedTimePeriod) {
- List<EntityExpr> lastPeriodHistoryConditions = [
- EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds),
- EntityCondition.makeCondition('glAccountClassId', EntityOperator.IN, accountClassIds),
- EntityCondition.makeCondition('endingBalance', EntityOperator.NOT_EQUAL, BigDecimal.ZERO),
- EntityCondition.makeCondition('customTimePeriodId', EntityOperator.EQUALS,
- lastClosedTimePeriod.customTimePeriodId)
- ]
-
- from('GlAccountAndHistory').where(lastPeriodHistoryConditions).queryList().collect {
- history ->
- new AccountBalance(
- glAccountId: history.glAccountId,
- accountCode: history.accountCode,
- accountName: history.accountName,
- balance: history.getBigDecimal('endingBalance'),
- )
- }.each {
- retVal.put(it.glAccountId, it)
- }
- }
-
- retVal
-}
-
-// Get the opening balances of all the accounts
-Map<String, AccountBalance> assetOpeningBalances = getLastPeriodClosingBalancesForAccountClassIds(assetAccountClassIds)
-Map<String, AccountBalance> contraAssetOpeningBalances = getLastPeriodClosingBalancesForAccountClassIds(contraAssetAccountClassIds)
-Map<String, AccountBalance> currentAssetOpeningBalances = getLastPeriodClosingBalancesForAccountClassIds(currentAssetAccountClassIds)
-Map<String, AccountBalance> longtermAssetOpeningBalances = getLastPeriodClosingBalancesForAccountClassIds(longtermAssetAccountClassIds)
-Map<String, AccountBalance> liabilityOpeningBalances = getLastPeriodClosingBalancesForAccountClassIds(liabilityAccountClassIds)
-Map<String, AccountBalance> currentLiabilityOpeningBalances = getLastPeriodClosingBalancesForAccountClassIds(currentLiabilityAccountClassIds)
-Map<String, AccountBalance> equityOpeningBalances = getLastPeriodClosingBalancesForAccountClassIds(equityAccountClassIds)
-
-List balanceTotalList = []
-
-class AccountEntrySum {
-
- String glAccountId
- String accountCode
- String accountName
- String debitCreditFlag
- BigDecimal amount
-
-}
-
-/**
- * Retrieve a collection of AccountEntrySum objects corresponding to the AcctgTransEntrySums entities query controlled
- * by the given conditions.
- *
- * @param conditions The list of conditions to be ANDed together and form the WHERE clause for the query of
- * AcctgTransEntrySums.
- *
- * @return A collection of AccountEntrySum objects for the conditions.
- */
-Closure<List<AccountEntrySum>> getAccountEntrySumsForCondition = { Collection<EntityExpr> conditions ->
- from('AcctgTransEntrySums')
- .where(conditions)
- .orderBy('glAccountId')
- .select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .queryList()
- .collect { entrySum ->
- new AccountEntrySum(
- glAccountId: entrySum.glAccountId,
- accountName: entrySum.accountName,
- accountCode: entrySum.accountCode,
- debitCreditFlag: entrySum.debitCreditFlag,
- amount: entrySum.getBigDecimal('amount')
- )
- }
-}
-
-/**
- * Retrieve a collection of AccountEntrySum objects corresponding to the organization's AcctgTransEntrySums entities
- * which match the given collection of Account Class IDs.
- *
- * @param accountClassIds The collection of Account Class IDs to filter by.
- *
- * @return A collection of AccountEntrySum objects corresponding to the given accountClassIds.
- */
-Closure<List<AccountEntrySum>> getAccountEntrySumsForClassIds = { Collection<String> accountClassIds ->
- List conditions = [
- EntityCondition.makeCondition('glAccountClassId', EntityOperator.IN, accountClassIds),
- EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds),
- EntityCondition.makeCondition('isPosted', EntityOperator.EQUALS, 'Y'),
- EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId),
- EntityCondition.makeCondition('acctgTransTypeId', EntityOperator.NOT_EQUAL, 'PERIOD_CLOSING'),
- EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate),
- EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN, thruDate)
- ]
-
- getAccountEntrySumsForCondition(conditions)
-}
-
-enum RootClass { DEBIT, CREDIT }
-
-/**
- * Calculates balances of the organization's GL Accounts which correspond to the given collection of Account Class IDs.
- * Balances are calculated by taking each account's opening balance from the given Map, and then adding all debit and
- * credit transaction entries from the current time period.
- *
- * @param openingBalances Map of GL Account IDs to AccountBalance objects representing the opening balance of the GL
- * Account for the current time period.
- * @param accountClassIds The collection of Account Class IDs used to define the queried GL Accounts.
- * @param rootClass Define whether the collection of Account Class IDs should be treated as Debit or Credit accounts.
- * This controls how the balance of the account is calculated:
- * Debit account balance = totalDebits - totalCredits
- * Credit account balance = totalCredits - totalDebits
- * @param negateBalances Specify whether balances should be negated after they have been calculated according to the
- * debit/credit flag of any accounts for which transaction entries are found.
- */
-Closure<Map<String,AccountBalance>> calculateBalances = { Map<String, AccountBalance> openingBalances,
- Collection<String> accountClassIds,
- RootClass rootClass,
- boolean negateBalances = false ->
-
- Map<String, AccountBalance> accountBalancesByGlAccountId = [*:openingBalances]
-
- getAccountEntrySumsForClassIds(accountClassIds).each { entrySum ->
- AccountBalance existingAccountBalance = accountBalancesByGlAccountId.getOrDefault(
- entrySum.glAccountId,
- new AccountBalance(
- glAccountId: entrySum.glAccountId,
- accountCode: entrySum.accountCode,
- accountName: entrySum.accountName,
- balance: 0.0
- ))
-
- BigDecimal transactionSumsDebitAmount = entrySum.debitCreditFlag == 'D' ? entrySum.amount : 0.0
- BigDecimal transactionSumsCreditAmount = entrySum.debitCreditFlag == 'C' ? entrySum.amount : 0.0
-
- BigDecimal currentBalance = existingAccountBalance.balance
- BigDecimal combinedBalance = rootClass == RootClass.DEBIT ?
- currentBalance + transactionSumsDebitAmount - transactionSumsCreditAmount :
- currentBalance + transactionSumsCreditAmount - transactionSumsDebitAmount
-
- accountBalancesByGlAccountId.put(entrySum.glAccountId, new AccountBalance(
- glAccountId: entrySum.glAccountId,
- accountCode: entrySum.accountCode,
- accountName: entrySum.accountName,
- balance: combinedBalance
- ))
- }
-
- if (negateBalances) {
- accountBalancesByGlAccountId = accountBalancesByGlAccountId.collectEntries {
- glAccountId, accountBalance ->
- [(glAccountId): new AccountBalance(
- glAccountId: glAccountId,
- accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName,
- balance: negateBalances ? accountBalance.balance.negate() : accountBalance.balance)]
- } as Map<String, AccountBalance>
- }
-
- accountBalancesByGlAccountId
-}
-
-static List<Map<String, Serializable>> sortAccountBalancesConvertToMaps(Collection<AccountBalance> accountBalances) {
- return accountBalances.sort { a, b -> (a.accountCode <=> b.accountCode) } *.asMap()
-}
-
-static BigDecimal sumAccountBalances(Collection<AccountBalance> accountBalances) {
- return accountBalances*.balance.inject(BigDecimal.ZERO) { acc, val -> acc + val }
-}
-
-// ASSETS
-Map<String, AccountBalance> assetAccountBalances = calculateBalances(assetOpeningBalances, assetAccountClassIds, RootClass.DEBIT)
-BigDecimal assetBalanceTotal = sumAccountBalances(assetAccountBalances.values())
-List<Map<String, Serializable>> assetAccountBalanceList = sortAccountBalancesConvertToMaps(assetAccountBalances.values())
-assetAccountBalanceList.add([accountName: uiLabelMap.AccountingTotalAssets, balance: assetBalanceTotal]
- as LinkedHashMap<String, Serializable>)
-
-// CURRENT ASSETS
-Map<String, AccountBalance> currentAssetAccountBalances =
- calculateBalances(currentAssetOpeningBalances, currentAssetAccountClassIds, RootClass.DEBIT)
-BigDecimal currentAssetBalanceTotal = sumAccountBalances(currentAssetAccountBalances.values())
-
-// LONGTERM ASSETS
-Map<String, AccountBalance> longtermAssetAccountBalances =
- calculateBalances(longtermAssetOpeningBalances, longtermAssetAccountClassIds, RootClass.DEBIT)
-BigDecimal longtermAssetBalanceTotal = sumAccountBalances(longtermAssetAccountBalances.values())
-
-// CONTRA ASSETS
-// Contra assets are accounts of class CREDIT, but for the purposes of the balance sheet, they will be listed alongside
-// regular asset accounts in order to offset the total of all assets. We therefore negate these balances before
-// including them in sums with the asset accounts.
-Map<String, AccountBalance> contraAssetAccountBalances =
- calculateBalances(contraAssetOpeningBalances, contraAssetAccountClassIds, RootClass.CREDIT, true)
-BigDecimal contraAssetBalanceTotal = sumAccountBalances(contraAssetAccountBalances.values())
-List<Map<String, Serializable>> contraAssetAccountBalanceList = sortAccountBalancesConvertToMaps(contraAssetAccountBalances.values())
-assetAccountBalanceList.addAll(contraAssetAccountBalanceList)
-assetAccountBalanceList.add([accountName: uiLabelMap.AccountingTotalAccumulatedDepreciation,
- balance: contraAssetBalanceTotal]
- as LinkedHashMap<String, Serializable>)
-
-// LIABILITY
-Map<String, AccountBalance> liabilityAccountBalances = calculateBalances(liabilityOpeningBalances, liabilityAccountClassIds, RootClass.CREDIT)
-BigDecimal liabilityBalanceTotal = sumAccountBalances(liabilityAccountBalances.values())
-List<Map<String, Serializable>> liabilityAccountBalanceList = sortAccountBalancesConvertToMaps(liabilityAccountBalances.values())
-liabilityAccountBalanceList.add([accountName: uiLabelMap.AccountingTotalLiabilities, balance: liabilityBalanceTotal]
- as LinkedHashMap<String, Serializable>)
-
-// CURRENT LIABILITY
-Map<String, AccountBalance> currentLiabilityAccountBalances =
- calculateBalances(currentLiabilityOpeningBalances, currentLiabilityAccountClassIds, RootClass.CREDIT)
-BigDecimal currentLiabilityBalanceTotal = sumAccountBalances(currentLiabilityAccountBalances.values())
-
-// EQUITY
-Map<String, AccountBalance> equityAccountBalances = calculateBalances(equityOpeningBalances, equityAccountClassIds, RootClass.CREDIT)
-
-// Add the "retained earnings" account
-Map netIncomeResult = runService('prepareIncomeStatement',
- [organizationPartyId: organizationPartyId, glFiscalTypeId: glFiscalTypeId,
- fromDate: fromDate, 'thruDate': thruDate, userLogin: userLogin])
-BigDecimal netIncome = (BigDecimal)netIncomeResult.totalNetIncome
-GenericValue retainedEarningsAccount = from('GlAccountTypeDefault')
- .where('glAccountTypeId', 'RETAINED_EARNINGS', 'organizationPartyId', organizationPartyId).cache(true).queryOne()
-if (retainedEarningsAccount) {
- GenericValue retainedEarningsGlAccount = retainedEarningsAccount.getRelatedOne('GlAccount', false)
-
- AccountBalance retainedEarningsAccountBalance = equityAccountBalances.getOrDefault(retainedEarningsGlAccount.glAccountId, new AccountBalance(
- glAccountId: retainedEarningsGlAccount.glAccountId,
- accountCode: retainedEarningsGlAccount.accountCode,
- accountName: retainedEarningsGlAccount.accountName,
- balance: 0.0
- ))
-
- retainedEarningsAccountBalance.balance += netIncome
-
- equityAccountBalances.put(retainedEarningsGlAccount.glAccountId as String, retainedEarningsAccountBalance)
-}
-
-BigDecimal equityBalanceTotal = sumAccountBalances(equityAccountBalances.values())
-List<Map<String, Serializable>> equityAccountBalanceList = sortAccountBalancesConvertToMaps(equityAccountBalances.values())
-equityAccountBalanceList.add(UtilMisc.toMap('accountName', uiLabelMap.AccountingTotalEquities, 'balance', equityBalanceTotal))
-
-context.assetBalanceTotal = assetBalanceTotal
-context.assetAccountBalanceList = assetAccountBalanceList
-
-context.currentAssetBalanceTotal = currentAssetBalanceTotal
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingCurrentAssets', 'balance', currentAssetBalanceTotal))
-
-context.longtermAssetBalanceTotal = longtermAssetBalanceTotal
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingLongTermAssets', 'balance', longtermAssetBalanceTotal))
-
-context.contraAssetBalanceTotal = contraAssetBalanceTotal
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingTotalAccumulatedDepreciation', 'balance', contraAssetBalanceTotal))
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingTotalAssets', 'balance',
- (context.currentAssetBalanceTotal + context.longtermAssetBalanceTotal + contraAssetBalanceTotal)))
-
-context.liabilityAccountBalanceList = liabilityAccountBalanceList
-context.liabilityBalanceTotal = liabilityBalanceTotal
-
-context.currentLiabilityBalanceTotal = currentLiabilityBalanceTotal
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingCurrentLiabilities', 'balance', currentLiabilityBalanceTotal))
-
-context.equityAccountBalanceList = equityAccountBalanceList
-context.equityBalanceTotal = equityBalanceTotal
-
-context.liabilityEquityBalanceTotal = liabilityBalanceTotal + equityBalanceTotal
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingEquities', 'balance', context.equityBalanceTotal))
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingTotalLiabilitiesAndEquities', 'balance', context.liabilityEquityBalanceTotal))
-
-context.balanceTotalList = balanceTotalList
diff --git a/applications/accounting/groovyScripts/reports/CashFlowStatement.groovy b/applications/accounting/groovyScripts/reports/CashFlowStatement.groovy
deleted file mode 100644
index da602d3ed9..0000000000
--- a/applications/accounting/groovyScripts/reports/CashFlowStatement.groovy
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.accounting.util.UtilAccounting
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilMisc
-import org.apache.ofbiz.base.util.UtilProperties
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-import org.apache.ofbiz.party.party.PartyWorker
-
-import java.sql.Timestamp
-
-if (!fromDate) {
- return
-}
-thruDate = thruDate ?: UtilDateTime.nowTimestamp()
-parameters.glFiscalTypeId = parameters.glFiscalTypeId ?: 'ACTUAL'
-
-uiLabelMap = UtilProperties.getResourceBundleMap('AccountingUiLabels', locale)
-parametersFromDate = fromDate
-
-// Setup the divisions for which the report is executed
-List partyIds = PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator,
- parameters.get('ApplicationDecorator|organizationPartyId'), 'GROUP_ROLLUP')
-partyIds.add(parameters.get('ApplicationDecorator|organizationPartyId'))
-
-// Get the group of account classes that will be used to position accounts in the proper section of the Cash Flow statement
-GenericValue glAccountClass = from('GlAccountClass').where('glAccountClassId', 'CASH_EQUIVALENT').cache(true).queryOne()
-List glAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(glAccountClass)
-
-List cashFlowBalanceTotalList = []
-
-// Find the last closed time period to get the fromDate for the transactions in the current period and the ending balances of the last closed period
-Map lastClosedTimePeriodResult = runService('findLastClosedDate',
- ['organizationPartyId': parameters.get('ApplicationDecorator|organizationPartyId'), 'findDate': parametersFromDate, 'userLogin': userLogin])
-Timestamp periodClosingFromDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate
-if (!periodClosingFromDate) {
- return
-}
-GenericValue lastClosedTimePeriod = (GenericValue)lastClosedTimePeriodResult.lastClosedTimePeriod
-// Get the opening balances of Cash Account
-Map openingCashBalances = [:]
-if (lastClosedTimePeriod) {
- List timePeriodAndExprs = []
- timePeriodAndExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
- timePeriodAndExprs.add(EntityCondition.makeCondition('glAccountClassId', EntityOperator.IN, glAccountClassIds))
- timePeriodAndExprs.add(EntityCondition.makeCondition('endingBalance', EntityOperator.NOT_EQUAL, BigDecimal.ZERO))
- timePeriodAndExprs.add(EntityCondition.makeCondition('customTimePeriodId', EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId))
- List lastTimePeriodHistories = from('GlAccountAndHistory').where(timePeriodAndExprs).queryList()
- lastTimePeriodHistories.each { lastTimePeriodHistory ->
- Map accountMap = ['glAccountId': lastTimePeriodHistory.glAccountId, 'accountCode': lastTimePeriodHistory.accountCode,
- 'accountName': lastTimePeriodHistory.accountName, 'balance': lastTimePeriodHistory.getBigDecimal('endingBalance'),
- 'D': lastTimePeriodHistory.getBigDecimal('postedDebits'), 'C': lastTimePeriodHistory.getBigDecimal('postedCredits')]
- openingCashBalances.(lastTimePeriodHistory.glAccountId) = accountMap
- }
-}
-List mainAndExprs = []
-mainAndExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
-mainAndExprs.add(EntityCondition.makeCondition('isPosted', EntityOperator.EQUALS, 'Y'))
-mainAndExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, parameters.glFiscalTypeId))
-mainAndExprs.add(EntityCondition.makeCondition('glAccountClassId', EntityOperator.IN, glAccountClassIds))
-
-// All GlAccount's transactions (from last closing period to parameter's fromDate)
-accountBalanceList = []
-transactionTotals = []
-balanceTotal = BigDecimal.ZERO
-List openingCashBalanceAndExprs = mainAndExprs as LinkedList
-openingCashBalanceAndExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, periodClosingFromDate))
-openingCashBalanceAndExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN, parametersFromDate))
-transactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(openingCashBalanceAndExprs).orderBy('glAccountId').queryList()
-transactionTotalsMap = [:]
-transactionTotalsMap.putAll(openingCashBalances)
-transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
- if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal)
- accountMap.remove('debitCreditFlag')
- accountMap.remove('amount')
- accountMap.D = BigDecimal.ZERO
- accountMap.C = BigDecimal.ZERO
- accountMap.balance = BigDecimal.ZERO
- }
- if (accountMap.debitCreditFlag && accountMap.amount) {
- accountMap.remove('debitCreditFlag')
- accountMap.remove('amount')
- }
- if (transactionTotal.debitCreditFlag == 'C') {
- accountMap.C = ((BigDecimal)accountMap.get('C')).add(transactionTotal.amount)
- accountMap.balance = (accountMap.balance).subtract(transactionTotal.amount)
- } else {
- accountMap.D = ((BigDecimal)accountMap.get('D')).add(transactionTotal.amount)
- accountMap.balance = (accountMap.balance).add(transactionTotal.amount)
- }
-
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
-}
-glAccountIdList = []
-accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList('accountCode'))
-accountBalanceList.each { accountBalance ->
- balanceTotal = balanceTotal.add(accountBalance.balance)
-}
-openingCashBalanceTotal = balanceTotal
-context.openingCashBalanceList = accountBalanceList
-cashFlowBalanceTotalList.add('totalName': 'AccountingOpeningCashBalance', 'balance': balanceTotal)
-openingTransactionKeySet = transactionTotalsMap.keySet()
-
-// PERIOD CASH BALANCE
-// GlAccounts from parameter's fromDate to parameter's thruDate.
-accountBalanceList = []
-transactionTotals = []
-balanceTotal = BigDecimal.ZERO
-List periodCashBalanceAndExprs = mainAndExprs as LinkedList
-periodCashBalanceAndExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, parametersFromDate))
-periodCashBalanceAndExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN, thruDate))
-transactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(periodCashBalanceAndExprs).orderBy('glAccountId').queryList()
-if (transactionTotals) {
- Map transactionTotalsMap = [:]
- balanceTotalCredit = BigDecimal.ZERO
- balanceTotalDebit = BigDecimal.ZERO
- transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
- if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal)
- accountMap.remove('debitCreditFlag')
- accountMap.remove('amount')
- accountMap.D = BigDecimal.ZERO
- accountMap.C = BigDecimal.ZERO
- accountMap.balance = BigDecimal.ZERO
- }
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
- if (transactionTotal.debitCreditFlag == 'D') {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
- } else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
- }
- BigDecimal debitAmount = (BigDecimal)accountMap.D
- BigDecimal creditAmount = (BigDecimal)accountMap.C
- BigDecimal balance = debitAmount.subtract(creditAmount)
- accountMap.balance = balance
- transactionTotalsMap.(transactionTotal.glAccountId) = accountMap
- }
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList('accountCode'))
- balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit)
-}
-periodCashBalanceTotal = balanceTotal
-context.periodCashBalanceList = accountBalanceList
-context.periodCashBalanceList.add('accountName': uiLabelMap.AccountingTotalPeriodCashBalance, 'balance': balanceTotal)
-cashFlowBalanceTotalList.add('totalName': 'AccountingPeriodCashBalance', 'balance': balanceTotal)
-
-// CLOSING BALANCE
-// GlAccounts from parameter's fromDate to parameter's thruDate.
-accountBalanceList = []
-balanceTotal = BigDecimal.ZERO
-List transactionTotals = []
-transactionTotals.addAll(new LinkedList(context.openingCashBalanceList))
-transactionTotals.addAll(new LinkedList(context.periodCashBalanceList))
-transactionTotals = UtilMisc.sortMaps(transactionTotals, UtilMisc.toList('accountCode'))
-closingTransactionKeySet = []
-if (transactionTotals) {
- Map transactionTotalsMap = [:]
- balanceTotalCredit = BigDecimal.ZERO
- balanceTotalDebit = BigDecimal.ZERO
- transactionTotals.each { transactionTotal ->
- if (transactionTotal.D != null) {
- if (transactionTotalsMap.(transactionTotal.glAccountId)) {
- totalDebitBalance = (transactionTotal.D).add(transactionTotalsMap.(transactionTotal.glAccountId).D)
- totalCreditBalance = (transactionTotal.C).add(transactionTotalsMap.(transactionTotal.glAccountId).C)
- if (transactionTotalsMap.(transactionTotal.glAccountId).D == 0 && transactionTotalsMap.(transactionTotal.glAccountId).C == 0) {
- transactionTotalsMap.(transactionTotal.glAccountId).balance =
- (transactionTotal.balance).add(transactionTotalsMap.(transactionTotal.glAccountId).balance)
- } else {
- transactionTotalsMap.(transactionTotal.glAccountId).D = totalDebitBalance
- transactionTotalsMap.(transactionTotal.glAccountId).C = totalCreditBalance
- transactionTotalsMap.(transactionTotal.glAccountId).balance = totalDebitBalance.subtract(totalCreditBalance)
- }
- } else {
- transactionTotalsMap.(transactionTotal.glAccountId) = transactionTotal
- }
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList('accountCode'))
- }
- }
- closingTransactionKeySet = transactionTotalsMap.keySet()
-}
-accountBalanceList.each { accountBalance ->
- balanceTotal = balanceTotal.add(accountBalance.balance)
-}
-context.closingCashBalanceList = accountBalanceList
-context.closingCashBalanceList.add('accountName': uiLabelMap.AccountingTotalClosingCashBalance, 'balance': balanceTotal)
-
-// Get differences of glAccount in closing and opening list and then add difference to opening list.
-if (closingTransactionKeySet) {
- closingTransactionKeySet.removeAll(openingTransactionKeySet)
- closingTransactionKeySet.each { closingTransactionKey ->
- glAccount = from('GlAccount').where('glAccountId', closingTransactionKey).cache(true).queryOne()
- context.openingCashBalanceList.add(['glAccountId': glAccount.glAccountId, 'accountName': glAccount.accountName,
- accountCode: glAccount.accountCode, balance: BigDecimal.ZERO, D: BigDecimal.ZERO, C: BigDecimal.ZERO])
- }
-}
-context.openingCashBalanceList.add(['accountName': uiLabelMap.AccountingTotalOpeningCashBalance, 'balance': openingCashBalanceTotal])
-
-// CASH FLOW STATEMENT ENDING BALANCE
-// ENDING BALANCE = OPENING CASH BALANCE + PERIOD CASH BALANCE
-endingCashBalanceTotal = openingCashBalanceTotal.add(periodCashBalanceTotal)
-cashFlowBalanceTotalList.add('totalName': 'AccountingEndingCashBalance', 'balance': endingCashBalanceTotal)
-context.cashFlowBalanceTotalList = cashFlowBalanceTotalList
diff --git a/applications/accounting/groovyScripts/reports/ComparativeBalanceSheet.groovy b/applications/accounting/groovyScripts/reports/ComparativeBalanceSheet.groovy
deleted file mode 100644
index b4d7013d4b..0000000000
--- a/applications/accounting/groovyScripts/reports/ComparativeBalanceSheet.groovy
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.base.util.UtilMisc
-
-assetAccountBalanceMap = [:]
-assetAccountBalanceList = []
-assetAccountBalanceList1.each { accountBalance ->
- assetAccountBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance1: accountBalance.balance,
- balance2: BigDecimal.ZERO])
-}
-assetAccountBalanceList2.each { accountBalance ->
- Map assetAccount = (Map)assetAccountBalanceMap.get(accountBalance.glAccountId)
- if (assetAccount) {
- assetAccount.put('balance2', accountBalance.balance)
- } else {
- assetAccountBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance2: accountBalance.balance,
- balance1: BigDecimal.ZERO])
- }
-}
-assetAccountBalanceList = UtilMisc.sortMaps(assetAccountBalanceMap.values().asList(), UtilMisc.toList('accountCode'))
-context.assetAccountBalanceList = assetAccountBalanceList
-
-liabilityAccountBalanceMap = [:]
-liabilityAccountBalanceList = []
-liabilityAccountBalanceList1.each { accountBalance ->
- liabilityAccountBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance1: accountBalance.balance,
- balance2: BigDecimal.ZERO])
-}
-liabilityAccountBalanceList2.each { accountBalance ->
- Map assetAccount = (Map)liabilityAccountBalanceMap.get(accountBalance.glAccountId)
- if (assetAccount) {
- assetAccount.put('balance2', accountBalance.balance)
- } else {
- liabilityAccountBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance2: accountBalance.balance,
- balance1: BigDecimal.ZERO])
- }
-}
-liabilityAccountBalanceList = UtilMisc.sortMaps(liabilityAccountBalanceMap.values().asList(), UtilMisc.toList('accountCode'))
-context.liabilityAccountBalanceList = liabilityAccountBalanceList
-
-equityAccountBalanceMap = [:]
-equityAccountBalanceList = []
-equityAccountBalanceList1.each { accountBalance ->
- equityAccountBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance1: accountBalance.balance,
- balance2: BigDecimal.ZERO])
-}
-equityAccountBalanceList2.each { accountBalance ->
- Map assetAccount = (Map)equityAccountBalanceMap.get(accountBalance.glAccountId)
- if (assetAccount) {
- assetAccount.put('balance2', accountBalance.balance)
- } else {
- equityAccountBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance2: accountBalance.balance,
- balance1: BigDecimal.ZERO])
- }
-}
-equityAccountBalanceList = UtilMisc.sortMaps(equityAccountBalanceMap.values().asList(), UtilMisc.toList('accountCode'))
-context.equityAccountBalanceList = equityAccountBalanceList
-
-balanceTotalMap = [:]
-balanceTotalList = []
-balanceTotalList1.each { accountBalance ->
- balanceTotalMap.put(accountBalance.totalName, [totalName: accountBalance.totalName, balance1: accountBalance.balance, balance2: BigDecimal.ZERO])
-}
-balanceTotalList2.each { accountBalance ->
- Map assetAccount = (Map)balanceTotalMap.get(accountBalance.totalName)
- if (assetAccount) {
- assetAccount.put('balance2', accountBalance.balance)
- } else {
- balanceTotalMap.put(accountBalance.totalName, [totalName: accountBalance.totalName, balance2: accountBalance.balance,
- balance1: BigDecimal.ZERO])
- }
-}
-balanceTotalList = balanceTotalMap.values().asList()
-context.balanceTotalList = balanceTotalList
diff --git a/applications/accounting/groovyScripts/reports/ComparativeCashFlowStatement.groovy b/applications/accounting/groovyScripts/reports/ComparativeCashFlowStatement.groovy
deleted file mode 100644
index d573149723..0000000000
--- a/applications/accounting/groovyScripts/reports/ComparativeCashFlowStatement.groovy
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.base.util.UtilMisc
-
-openingCashBalanceMap = [:]
-openingCashBalanceList = []
-openingCashBalanceList1.each { accountBalance ->
- openingCashBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance1: accountBalance.balance,
- balance2: BigDecimal.ZERO])
-}
-openingCashBalanceList2.each { accountBalance ->
- Map openingCashAccount = (Map)openingCashBalanceMap.get(accountBalance.glAccountId)
- if (openingCashAccount) {
- openingCashAccount.put('balance2', accountBalance.balance)
- } else {
- openingCashBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance2: accountBalance.balance,
- balance1: BigDecimal.ZERO])
- }
-}
-openingCashBalanceList = UtilMisc.sortMaps(openingCashBalanceMap.values().asList(), UtilMisc.toList('accountCode'))
-context.openingCashBalanceList = openingCashBalanceList
-
-periodCashBalanceMap = [:]
-periodCashBalanceList = []
-periodCashBalanceList1.each { accountBalance ->
- periodCashBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance1: accountBalance.balance,
- balance2: BigDecimal.ZERO, D1: accountBalance.D, C1: accountBalance.C,
- D2: BigDecimal.ZERO, C2: BigDecimal.ZERO])
-}
-periodCashBalanceList2.each { accountBalance ->
- Map periodCashAccount = (Map)periodCashBalanceMap.get(accountBalance.glAccountId)
- if (periodCashAccount) {
- periodCashAccount.put('balance2', accountBalance.balance)
- periodCashAccount.put('D2', accountBalance.D)
- periodCashAccount.put('C2', accountBalance.C)
- } else {
- periodCashBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance2: accountBalance.balance,
- balance1: BigDecimal.ZERO, D2: accountBalance.D, C2: accountBalance.C,
- D1: BigDecimal.ZERO, C1: BigDecimal.ZERO])
- }
-}
-periodCashBalanceList = UtilMisc.sortMaps(periodCashBalanceMap.values().asList(), UtilMisc.toList('accountCode'))
-
-context.periodCashBalanceList = periodCashBalanceList
-closingCashBalanceMap = [:]
-closingCashBalanceList = []
-closingCashBalanceList1.each { accountBalance ->
- closingCashBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance1: accountBalance.balance,
- balance2: BigDecimal.ZERO])
-}
-closingCashBalanceList2.each { accountBalance ->
- Map closingCashAccount = (Map)closingCashBalanceMap.get(accountBalance.glAccountId)
- if (closingCashAccount) {
- closingCashAccount.put('balance2', accountBalance.balance)
- } else {
- closingCashBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance2: accountBalance.balance,
- balance1: BigDecimal.ZERO])
- }
-}
-closingCashBalanceList = UtilMisc.sortMaps(closingCashBalanceMap.values().asList(), UtilMisc.toList('accountCode'))
-context.closingCashBalanceList = closingCashBalanceList
-
-balanceTotalMap = [:]
-cashFlowBalanceTotalList = []
-cashFlowBalanceTotalList1.each { accountBalance ->
- balanceTotalMap.put(accountBalance.totalName, [totalName: accountBalance.totalName, balance1: accountBalance.balance, balance2: BigDecimal.ZERO])
-}
-cashFlowBalanceTotalList2.each { accountBalance ->
- Map cashFlowBalanceAccount = (Map)balanceTotalMap.get(accountBalance.totalName)
- if (cashFlowBalanceAccount) {
- cashFlowBalanceAccount.put('balance2', accountBalance.balance)
- } else {
- balanceTotalMap.put(accountBalance.totalName, [totalName: accountBalance.totalName, balance2: accountBalance.balance,
- balance1: BigDecimal.ZERO])
- }
-}
-cashFlowBalanceTotalList = balanceTotalMap.values().asList()
-context.cashFlowBalanceTotalList = cashFlowBalanceTotalList
-
diff --git a/applications/accounting/groovyScripts/reports/ComparativeIncomeStatement.groovy b/applications/accounting/groovyScripts/reports/ComparativeIncomeStatement.groovy
deleted file mode 100644
index 5e237e0c3f..0000000000
--- a/applications/accounting/groovyScripts/reports/ComparativeIncomeStatement.groovy
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.base.util.UtilMisc
-
-revenueAccountBalanceMap = [:]
-revenueAccountBalanceList = []
-revenueAccountBalanceList1.each { accountBalance ->
- revenueAccountBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance1: accountBalance.balance,
- balance2: BigDecimal.ZERO])
-}
-revenueAccountBalanceList2.each { accountBalance ->
- Map assetAccount = (Map)revenueAccountBalanceMap.get(accountBalance.glAccountId)
- if (assetAccount) {
- assetAccount.put('balance2', accountBalance.balance)
- } else {
- revenueAccountBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance2: accountBalance.balance,
- balance1: BigDecimal.ZERO])
- }
-}
-revenueAccountBalanceList = UtilMisc.sortMaps(revenueAccountBalanceMap.values().asList(), UtilMisc.toList('accountCode'))
-context.revenueAccountBalanceList = revenueAccountBalanceList
-
-expenseAccountBalanceMap = [:]
-expenseAccountBalanceList = []
-expenseAccountBalanceList1.each { accountBalance ->
- expenseAccountBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance1: accountBalance.balance,
- balance2: BigDecimal.ZERO])
-}
-expenseAccountBalanceList2.each { accountBalance ->
- Map assetAccount = (Map)expenseAccountBalanceMap.get(accountBalance.glAccountId)
- if (assetAccount) {
- assetAccount.put('balance2', accountBalance.balance)
- } else {
- expenseAccountBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance2: accountBalance.balance,
- balance1: BigDecimal.ZERO])
- }
-}
-expenseAccountBalanceList = UtilMisc.sortMaps(expenseAccountBalanceMap.values().asList(), UtilMisc.toList('accountCode'))
-context.expenseAccountBalanceList = expenseAccountBalanceList
-
-incomeAccountBalanceMap = [:]
-incomeAccountBalanceList = []
-incomeAccountBalanceList1.each { accountBalance ->
- incomeAccountBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance1: accountBalance.balance,
- balance2: BigDecimal.ZERO])
-}
-incomeAccountBalanceList2.each { accountBalance ->
- Map assetAccount = (Map)incomeAccountBalanceMap.get(accountBalance.glAccountId)
- if (assetAccount) {
- assetAccount.put('balance2', accountBalance.balance)
- } else {
- incomeAccountBalanceMap.put(accountBalance.glAccountId, [glAccountId: accountBalance.glAccountId, accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName, balance2: accountBalance.balance,
- balance1: BigDecimal.ZERO])
- }
-}
-incomeAccountBalanceList = UtilMisc.sortMaps(incomeAccountBalanceMap.values().asList(), UtilMisc.toList('accountCode'))
-context.incomeAccountBalanceList = incomeAccountBalanceList
-
-balanceTotalMap = [:]
-balanceTotalList = []
-balanceTotalList1.each { accountBalance ->
- balanceTotalMap.put(accountBalance.totalName, [totalName: accountBalance.totalName, balance1: accountBalance.balance, balance2: BigDecimal.ZERO])
-}
-balanceTotalList2.each { accountBalance ->
- Map assetAccount = (Map)balanceTotalMap.get(accountBalance.totalName)
- if (assetAccount) {
- assetAccount.put('balance2', accountBalance.balance)
- } else {
- balanceTotalMap.put(accountBalance.totalName, [totalName: accountBalance.totalName, balance2: accountBalance.balance,
- balance1: BigDecimal.ZERO])
- }
-}
-balanceTotalList = balanceTotalMap.values().asList()
-context.balanceTotalList = balanceTotalList
diff --git a/applications/accounting/groovyScripts/reports/CostCenters.groovy b/applications/accounting/groovyScripts/reports/CostCenters.groovy
deleted file mode 100644
index 18936990e2..0000000000
--- a/applications/accounting/groovyScripts/reports/CostCenters.groovy
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilMisc
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-
-if (!fromDate) {
- return
-}
-thruDate = thruDate ?: UtilDateTime.nowTimestamp()
-parameters.glFiscalTypeId = parameters.glFiscalTypeId ?: 'ACTUAL'
-
-// POSTED
-// Posted transactions totals and grand totals
-postedTotalDebit = BigDecimal.ZERO
-postedTotalCredit = BigDecimal.ZERO
-andExprs = []
-andExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
-andExprs.add(EntityCondition.makeCondition('isPosted', EntityOperator.EQUALS, 'Y'))
-andExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, parameters.glFiscalTypeId))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
-List postedTransactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(andCond).orderBy('glAccountId').queryList()
-if (postedTransactionTotals) {
- glAccountCategories = from('GlAccountCategory').where('glAccountCategoryTypeId', 'COST_CENTER').orderBy('glAccountCategoryId').queryList()
- context.glAccountCategories = glAccountCategories
- Map postedTransactionTotalsMap = [:]
- postedTransactionTotals.each { postedTransactionTotal ->
- Map accountMap = (Map)postedTransactionTotalsMap.get(postedTransactionTotal.glAccountId)
- if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(postedTransactionTotal)
- accountMap.put('D', BigDecimal.ZERO)
- accountMap.put('C', BigDecimal.ZERO)
- }
- UtilMisc.addToBigDecimalInMap(accountMap, postedTransactionTotal.debitCreditFlag, postedTransactionTotal.amount)
- postedTransactionTotalsMap.put(postedTransactionTotal.glAccountId, accountMap)
- BigDecimal debitAmount = (BigDecimal)accountMap.get('D')
- BigDecimal creditAmount = (BigDecimal)accountMap.get('C')
- BigDecimal balance = debitAmount.subtract(creditAmount)
- accountMap.put('balance', balance)
- glAccountCategories.each { glAccountCategory ->
- glAccountCategoryMember = from('GlAccountCategoryMember')
- .where('glAccountCategoryId', glAccountCategory.glAccountCategoryId, 'glAccountId', postedTransactionTotal.glAccountId)
- .orderBy('glAccountCategoryId').filterByDate().queryFirst()
- if (glAccountCategoryMember) {
- BigDecimal glAccountCategorySharePercentage = glAccountCategoryMember.amountPercentage
- if (glAccountCategorySharePercentage && glAccountCategorySharePercentage != BigDecimal.ZERO ) {
- glAccountCategoryShareFraction = glAccountCategorySharePercentage.divide(100.00)
- BigDecimal glAccountCategoryShare = balance * glAccountCategoryShareFraction
- accountMap.put(glAccountCategory.glAccountCategoryId, glAccountCategoryShare)
- }
- }
- }
- }
- context.glAcctBalancesByCostCenter = postedTransactionTotalsMap.values().asList()
-}
-
diff --git a/applications/accounting/groovyScripts/reports/GlAccountTrialBalance.groovy b/applications/accounting/groovyScripts/reports/GlAccountTrialBalance.groovy
deleted file mode 100644
index c1b18b28ce..0000000000
--- a/applications/accounting/groovyScripts/reports/GlAccountTrialBalance.groovy
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import com.ibm.icu.util.Calendar
-import org.apache.ofbiz.accounting.util.UtilAccounting
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilNumber
-
-import java.sql.Timestamp
-
-if (parameters.get('ApplicationDecorator|organizationPartyId')) {
- onlyIncludePeriodTypeIdList = []
- onlyIncludePeriodTypeIdList.add('FISCAL_YEAR')
- customTimePeriodResults = runService('findCustomTimePeriods',
- [findDate: UtilDateTime.nowTimestamp(), organizationPartyId: parameters.get('ApplicationDecorator|organizationPartyId'),
- onlyIncludePeriodTypeIdList: onlyIncludePeriodTypeIdList, userLogin: userLogin])
- customTimePeriodList = customTimePeriodResults.customTimePeriodList
- if (customTimePeriodList) {
- context.timePeriod = customTimePeriodList.first().customTimePeriodId
- }
- decimals = UtilNumber.getBigDecimalScale('ledger.decimals')
- rounding = UtilNumber.getBigDecimalRoundingMode('ledger.rounding')
- context.currentOrganization = from('PartyNameView').where('partyId', parameters.get('ApplicationDecorator|organizationPartyId')).queryOne()
- if (parameters.glAccountId) {
- glAccount = from('GlAccount').where('glAccountId', parameters.glAccountId).queryOne()
- isDebitAccount = UtilAccounting.isDebitAccount(glAccount)
- context.isDebitAccount = isDebitAccount
- context.glAccount = glAccount
- }
-
- currentTimePeriod = null
- BigDecimal balanceOfTheAcctgForYear = BigDecimal.ZERO
-
- if (parameters.timePeriod) {
- currentTimePeriod = from('CustomTimePeriod').where('customTimePeriodId', parameters.timePeriod).queryOne()
- previousTimePeriodResult = runService('getPreviousTimePeriod', [customTimePeriodId: parameters.timePeriod, userLogin: userLogin])
- previousTimePeriod = previousTimePeriodResult.previousTimePeriod
- if (previousTimePeriod) {
- glAccountHistory = from('GlAccountHistory')
- .where('customTimePeriodId', previousTimePeriod.customTimePeriodId, 'glAccountId', parameters.glAccountId,
- 'organizationPartyId', parameters.get('ApplicationDecorator|organizationPartyId')).queryOne()
- if (glAccountHistory && glAccountHistory.endingBalance != null) {
- context.openingBalance = glAccountHistory.endingBalance
- balanceOfTheAcctgForYear = glAccountHistory.endingBalance
- } else {
- context.openingBalance = BigDecimal.ZERO
- }
- }
- }
-
- if (currentTimePeriod) {
- context.currentTimePeriod = currentTimePeriod
- customTimePeriodStartDate = UtilDateTime.getMonthStart(UtilDateTime.toTimestamp(currentTimePeriod.fromDate), timeZone, locale)
- customTimePeriodEndDate = UtilDateTime.getMonthEnd(UtilDateTime.toTimestamp(currentTimePeriod.fromDate), timeZone, locale)
-
- Calendar calendarTimePeriodStartDate = UtilDateTime.toCalendar(customTimePeriodStartDate)
- glAcctgTrialBalanceList = []
- BigDecimal totalOfYearToDateDebit = BigDecimal.ZERO
- BigDecimal totalOfYearToDateCredit = BigDecimal.ZERO
- isPosted = parameters.isPosted
-
- while (customTimePeriodEndDate <= currentTimePeriod.thruDate) {
- if (isPosted == 'ALL') {
- isPosted = ''
- }
- acctgTransEntriesAndTransTotal = runService('getAcctgTransEntriesAndTransTotal',
- [customTimePeriodStartDate: customTimePeriodStartDate, customTimePeriodEndDate: customTimePeriodEndDate,
- organizationPartyId: parameters.get('ApplicationDecorator|organizationPartyId'),
- glAccountId: parameters.glAccountId, isPosted: isPosted, userLogin: userLogin])
- totalOfYearToDateDebit = totalOfYearToDateDebit + acctgTransEntriesAndTransTotal.debitTotal
- acctgTransEntriesAndTransTotal.totalOfYearToDateDebit = totalOfYearToDateDebit.setScale(decimals, rounding)
- totalOfYearToDateCredit = totalOfYearToDateCredit + acctgTransEntriesAndTransTotal.creditTotal
- acctgTransEntriesAndTransTotal.totalOfYearToDateCredit = totalOfYearToDateCredit.setScale(decimals, rounding)
-
- if (isDebitAccount) {
- acctgTransEntriesAndTransTotal.balance = acctgTransEntriesAndTransTotal.debitCreditDifference
- } else {
- acctgTransEntriesAndTransTotal.balance = -1 * acctgTransEntriesAndTransTotal.debitCreditDifference
- }
- balanceOfTheAcctgForYear = balanceOfTheAcctgForYear + acctgTransEntriesAndTransTotal.balance
- acctgTransEntriesAndTransTotal.balanceOfTheAcctgForYear = balanceOfTheAcctgForYear.setScale(decimals, rounding)
-
- glAcctgTrialBalanceList.add(acctgTransEntriesAndTransTotal)
-
- calendarTimePeriodStartDate.add(Calendar.MONTH, 1)
- Timestamp retStampStartDate = new Timestamp(calendarTimePeriodStartDate.getTimeInMillis())
- retStampStartDate.setNanos(0)
- customTimePeriodStartDate = retStampStartDate
- customTimePeriodEndDate = UtilDateTime.getMonthEnd(UtilDateTime.toTimestamp(retStampStartDate), timeZone, locale)
- }
- context.glAcctgTrialBalanceList = glAcctgTrialBalanceList
- }
-}
diff --git a/applications/accounting/groovyScripts/reports/IncomeStatement.groovy b/applications/accounting/groovyScripts/reports/IncomeStatement.groovy
deleted file mode 100644
index 41cc045f66..0000000000
--- a/applications/accounting/groovyScripts/reports/IncomeStatement.groovy
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilMisc
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-import org.apache.ofbiz.accounting.util.UtilAccounting
-import org.apache.ofbiz.party.party.PartyWorker
-
-if (!fromDate) {
- return
-}
-thruDate = thruDate ?: UtilDateTime.nowTimestamp()
-if (!glFiscalTypeId) {
- return
-}
-organizationPartyId = null
-if (context.organizationPartyId) {
- organizationPartyId = context.organizationPartyId
-} else {
- organizationPartyId = parameters.get('ApplicationDecorator|organizationPartyId')
-}
-
-// Setup the divisions for which the report is executed
-List partyIds = PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP')
-partyIds.add(organizationPartyId)
-
-// Get the group of account classes that will be used to position accounts in the proper section of the financial statement
-GenericValue revenueGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'REVENUE').cache(true).queryOne()
-List revenueAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(revenueGlAccountClass)
-GenericValue contraRevenueGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'CONTRA_REVENUE').cache(true).queryOne()
-List contraRevenueAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(contraRevenueGlAccountClass)
-GenericValue incomeGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'INCOME').cache(true).queryOne()
-List incomeAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(incomeGlAccountClass)
-GenericValue expenseGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'EXPENSE').cache(true).queryOne()
-List expenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(expenseGlAccountClass)
-GenericValue cogsExpenseGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'COGS_EXPENSE').cache(true).queryOne()
-List cogsExpenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(cogsExpenseGlAccountClass)
-GenericValue sgaExpenseGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'SGA_EXPENSE').cache(true).queryOne()
-List sgaExpenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(sgaExpenseGlAccountClass)
-GenericValue depreciationGlAccountClass = from('GlAccountClass').where('glAccountClassId', 'DEPRECIATION').cache(true).queryOne()
-List depreciationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(depreciationGlAccountClass)
-
-List mainAndExprs = []
-mainAndExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
-mainAndExprs.add(EntityCondition.makeCondition('isPosted', EntityOperator.EQUALS, 'Y'))
-mainAndExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId))
-mainAndExprs.add(EntityCondition.makeCondition('acctgTransTypeId', EntityOperator.NOT_EQUAL, 'PERIOD_CLOSING'))
-mainAndExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
-mainAndExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN, thruDate))
-
-List balanceTotalList = []
-
-// REVENUE
-// account balances
-accountBalanceList = []
-transactionTotals = []
-balanceTotal = BigDecimal.ZERO
-List revenueAndExprs = mainAndExprs as LinkedList
-revenueAndExprs.add(EntityCondition.makeCondition('glAccountClassId', EntityOperator.IN, revenueAccountClassIds))
-transactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(revenueAndExprs).orderBy('glAccountId').queryList()
-if (transactionTotals) {
- Map transactionTotalsMap = [:]
- balanceTotalCredit = BigDecimal.ZERO
- balanceTotalDebit = BigDecimal.ZERO
- transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
- if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal)
- accountMap.remove('debitCreditFlag')
- accountMap.remove('amount')
- accountMap.put('D', BigDecimal.ZERO)
- accountMap.put('C', BigDecimal.ZERO)
- accountMap.put('balance', BigDecimal.ZERO)
- }
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
- if (transactionTotal.debitCreditFlag == 'D') {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
- } else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
- }
- BigDecimal debitAmount = (BigDecimal)accountMap.get('D')
- BigDecimal creditAmount = (BigDecimal)accountMap.get('C')
- // revenues are accounts of class CREDIT: the balance is given by credits minus debits
- BigDecimal balance = creditAmount.subtract(debitAmount)
- accountMap.put('balance', balance)
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
- }
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList('accountCode'))
- // revenues are accounts of class CREDIT: the balance is given by credits minus debits
- balanceTotal = balanceTotalCredit.subtract(balanceTotalDebit)
-}
-context.revenueAccountBalanceList = accountBalanceList
-context.revenueAccountBalanceList.add(UtilMisc.toMap('accountName', 'TOTAL REVENUES', 'balance', balanceTotal))
-context.revenueBalanceTotal = balanceTotal
-
-// CONTRA REVENUE
-// account balances
-accountBalanceList = []
-transactionTotals = []
-balanceTotal = BigDecimal.ZERO
-List contraRevenueAndExprs = mainAndExprs as LinkedList
-contraRevenueAndExprs.add(EntityCondition.makeCondition('glAccountClassId', EntityOperator.IN, contraRevenueAccountClassIds))
-transactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(contraRevenueAndExprs).orderBy('glAccountId').queryList()
-if (transactionTotals) {
- Map transactionTotalsMap = [:]
- balanceTotalCredit = BigDecimal.ZERO
- balanceTotalDebit = BigDecimal.ZERO
- transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
- if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal)
- accountMap.remove('debitCreditFlag')
- accountMap.remove('amount')
- accountMap.put('D', BigDecimal.ZERO)
- accountMap.put('C', BigDecimal.ZERO)
- accountMap.put('balance', BigDecimal.ZERO)
- }
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
- if (transactionTotal.debitCreditFlag == 'D') {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
- } else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
- }
- BigDecimal debitAmount = (BigDecimal)accountMap.get('D')
- BigDecimal creditAmount = (BigDecimal)accountMap.get('C')
- // contra revenues are accounts of class DEBIT: the balance is given by debits minus credits
- BigDecimal balance = debitAmount.subtract(creditAmount)
- accountMap.put('balance', balance)
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
- }
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList('accountCode'))
- // contra revenues are accounts of class DEBIT: the balance is given by debits minus credits
- balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit)
-}
-context.contraRevenueBalanceTotal = balanceTotal
-balanceTotalList.add(UtilMisc.toMap('totalName', 'TOTAL CONTRA REVENUE', 'balance', balanceTotal))
-
-// EXPENSE
-// account balances
-accountBalanceList = []
-transactionTotals = []
-balanceTotal = BigDecimal.ZERO
-List expenseAndExprs = mainAndExprs as LinkedList
-expenseAndExprs.add(EntityCondition.makeCondition('glAccountClassId', EntityOperator.IN, expenseAccountClassIds))
-transactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(expenseAndExprs).queryList()
-if (transactionTotals) {
- Map transactionTotalsMap = [:]
- balanceTotalCredit = BigDecimal.ZERO
- balanceTotalDebit = BigDecimal.ZERO
- transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
- if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal)
- accountMap.remove('debitCreditFlag')
- accountMap.remove('amount')
- accountMap.put('D', BigDecimal.ZERO)
- accountMap.put('C', BigDecimal.ZERO)
- accountMap.put('balance', BigDecimal.ZERO)
- }
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
- if (transactionTotal.debitCreditFlag == 'D') {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
- } else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
- }
- BigDecimal debitAmount = (BigDecimal)accountMap.get('D')
- BigDecimal creditAmount = (BigDecimal)accountMap.get('C')
- // expenses are accounts of class DEBIT: the balance is given by debits minus credits
- BigDecimal balance = debitAmount.subtract(creditAmount)
- accountMap.put('balance', balance)
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
- }
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList('accountCode'))
- // expenses are accounts of class DEBIT: the balance is given by debits minus credits
- balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit)
-}
-context.expenseAccountBalanceList = accountBalanceList
-context.expenseAccountBalanceList.add(UtilMisc.toMap('accountName', 'TOTAL EXPENSES', 'balance', balanceTotal))
-context.expenseBalanceTotal = balanceTotal
-
-// COST OF GOODS SOLD (COGS_EXPENSE)
-// account balances
-accountBalanceList = []
-transactionTotals = []
-balanceTotal = BigDecimal.ZERO
-List cogsExpenseAndExprs = mainAndExprs as LinkedList
-cogsExpenseAndExprs.add(EntityCondition.makeCondition('glAccountClassId', EntityOperator.IN, cogsExpenseAccountClassIds))
-transactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(cogsExpenseAndExprs).orderBy('glAccountId').queryList()
-if (transactionTotals) {
- Map transactionTotalsMap = [:]
- balanceTotalCredit = BigDecimal.ZERO
- balanceTotalDebit = BigDecimal.ZERO
- transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
- if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal)
- accountMap.remove('debitCreditFlag')
- accountMap.remove('amount')
- accountMap.put('D', BigDecimal.ZERO)
- accountMap.put('C', BigDecimal.ZERO)
- accountMap.put('balance', BigDecimal.ZERO)
- }
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
- if (transactionTotal.debitCreditFlag == 'D') {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
- } else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
- }
- BigDecimal debitAmount = (BigDecimal)accountMap.get('D')
- BigDecimal creditAmount = (BigDecimal)accountMap.get('C')
- // expenses are accounts of class DEBIT: the balance is given by debits minus credits
- BigDecimal balance = debitAmount.subtract(creditAmount)
- accountMap.put('balance', balance)
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
- }
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList('accountCode'))
- // expenses are accounts of class DEBIT: the balance is given by debits minus credits
- balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit)
-}
-context.cogsExpense = balanceTotal
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingCostOfGoodsSold', 'balance', balanceTotal))
-
-// OPERATING EXPENSES (SGA_EXPENSE)
-// account balances
-accountBalanceList = []
-transactionTotals = []
-balanceTotal = BigDecimal.ZERO
-List sgaExpenseAndExprs = mainAndExprs as LinkedList
-sgaExpenseAndExprs.add(EntityCondition.makeCondition('glAccountClassId', EntityOperator.IN, sgaExpenseAccountClassIds))
-transactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(sgaExpenseAndExprs).orderBy('glAccountId').queryList()
-if (transactionTotals) {
- Map transactionTotalsMap = [:]
- balanceTotalCredit = BigDecimal.ZERO
- balanceTotalDebit = BigDecimal.ZERO
- transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
- if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal)
- accountMap.remove('debitCreditFlag')
- accountMap.remove('amount')
- accountMap.put('D', BigDecimal.ZERO)
- accountMap.put('C', BigDecimal.ZERO)
- accountMap.put('balance', BigDecimal.ZERO)
- }
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
- if (transactionTotal.debitCreditFlag == 'D') {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
- } else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
- }
- BigDecimal debitAmount = (BigDecimal)accountMap.get('D')
- BigDecimal creditAmount = (BigDecimal)accountMap.get('C')
- // expenses are accounts of class DEBIT: the balance is given by debits minus credits
- BigDecimal balance = debitAmount.subtract(creditAmount)
- accountMap.put('balance', balance)
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
- }
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList('accountCode'))
- // expenses are accounts of class DEBIT: the balance is given by debits minus credits
- balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit)
-}
-sgaExpense = balanceTotal
-
-//DEPRECIATION (DEPRECIATION)
-//account balances
-accountBalanceList = []
-transactionTotals = []
-balanceTotal = BigDecimal.ZERO
-List depreciationAndExprs = mainAndExprs as LinkedList
-depreciationAndExprs.add(EntityCondition.makeCondition('glAccountClassId', EntityOperator.IN, depreciationAccountClassIds))
-transactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(depreciationAndExprs).orderBy('glAccountId').queryList()
-if (transactionTotals) {
- Map transactionTotalsMap = [:]
- balanceTotalCredit = BigDecimal.ZERO
- balanceTotalDebit = BigDecimal.ZERO
- transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
- if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal)
- accountMap.remove('debitCreditFlag')
- accountMap.remove('amount')
- accountMap.put('D', BigDecimal.ZERO)
- accountMap.put('C', BigDecimal.ZERO)
- accountMap.put('balance', BigDecimal.ZERO)
- }
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
- if (transactionTotal.debitCreditFlag == 'D') {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
- } else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
- }
- BigDecimal debitAmount = (BigDecimal)accountMap.get('D')
- BigDecimal creditAmount = (BigDecimal)accountMap.get('C')
- // expenses are accounts of class DEBIT: the balance is given by debits minus credits
- BigDecimal balance = debitAmount.subtract(creditAmount)
- accountMap.put('balance', balance)
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
- }
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList('accountCode'))
- // expenses are accounts of class DEBIT: the balance is given by debits minus credits
- balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit)
-}
-depreciation = balanceTotal
-
-// INCOME
-// account balances
-accountBalanceList = []
-transactionTotals = []
-balanceTotal = BigDecimal.ZERO
-List incomeAndExprs = mainAndExprs as LinkedList
-incomeAndExprs.add(EntityCondition.makeCondition('glAccountClassId', EntityOperator.IN, incomeAccountClassIds))
-transactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(incomeAndExprs).orderBy('glAccountId').queryList()
-if (transactionTotals) {
- Map transactionTotalsMap = [:]
- balanceTotalCredit = BigDecimal.ZERO
- balanceTotalDebit = BigDecimal.ZERO
- transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
- if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal)
- accountMap.remove('debitCreditFlag')
- accountMap.remove('amount')
- accountMap.put('D', BigDecimal.ZERO)
- accountMap.put('C', BigDecimal.ZERO)
- accountMap.put('balance', BigDecimal.ZERO)
- }
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
- if (transactionTotal.debitCreditFlag == 'D') {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
- } else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
- }
- BigDecimal debitAmount = (BigDecimal)accountMap.get('D')
- BigDecimal creditAmount = (BigDecimal)accountMap.get('C')
- // income are accounts of class CREDIT: the balance is given by credits minus debits
- BigDecimal balance = creditAmount.subtract(debitAmount)
- accountMap.put('balance', balance)
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
- }
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList('accountCode'))
- // incomes are accounts of class CREDIT: the balance is given by credits minus debits
- balanceTotal = balanceTotalCredit.subtract(balanceTotalDebit)
-}
-context.incomeAccountBalanceList = accountBalanceList
-context.incomeAccountBalanceList.add(UtilMisc.toMap('accountName', 'TOTAL INCOME', 'balance', balanceTotal))
-context.incomeBalanceTotal = balanceTotal
-
-// NET SALES = REVENUES - CONTRA REVENUES
-context.netSales = (context.revenueBalanceTotal).subtract(context.contraRevenueBalanceTotal)
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingTotalNetSales', 'balance', context.netSales))
-// GROSS MARGIN = NET SALES - COSTS OF GOODS SOLD
-context.grossMargin = (context.netSales).subtract(context.cogsExpense)
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingGrossMargin', 'balance', context.grossMargin))
-// OPERATING EXPENSES
-context.sgaExpense = sgaExpense
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingOperatingExpenses', 'balance', context.sgaExpense))
-// DEPRECIATION
-context.depreciation = depreciation
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingDepreciation', 'balance', context.depreciation))
-// INCOME FROM OPERATIONS = GROSS MARGIN - OPERATING EXPENSES
-context.incomeFromOperations = (context.grossMargin).subtract(context.sgaExpense)
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingIncomeFromOperations', 'balance', context.incomeFromOperations))
-// NET INCOME
-context.netIncome = (context.netSales).add(context.incomeBalanceTotal).subtract(context.expenseBalanceTotal)
-balanceTotalList.add(UtilMisc.toMap('totalName', 'AccountingNetIncome', 'balance', context.netIncome))
-
-context.balanceTotalList = balanceTotalList
diff --git a/applications/accounting/groovyScripts/reports/InvoiceAcctgTransEntryParameters.groovy b/applications/accounting/groovyScripts/reports/InvoiceAcctgTransEntryParameters.groovy
deleted file mode 100644
index 9a066eae8c..0000000000
--- a/applications/accounting/groovyScripts/reports/InvoiceAcctgTransEntryParameters.groovy
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.base.util.UtilMisc
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-
-invoiceId = parameters.invoiceId
-userLoginId = userLogin.userLoginId
-userLogin = from('UserLogin').where('userLoginId', userLoginId).queryOne()
-userLoginNameView = from('PartyNameView').where('partyId', userLogin.get('partyId')).queryOne()
-userLoginName = userLoginNameView.getString('firstName') + ' ' + userLoginNameView.getString('lastName')
-dateFormatter = new java.text.SimpleDateFormat('dd MMMMM yyyy', locale)
-
-invoice = from('Invoice').where('invoiceId', invoiceId).queryOne()
-if (invoice) {
- context.invoiceDescription = invoice.get('description')
- context.invoiceTypeDescription = invoice.getRelatedOne('InvoiceType', false).get('description')
- context.statusDescription = invoice.getRelatedOne('StatusItem', false).get('description')
- context.invoiceDate = invoice.get('invoiceDate')
- context.referenceNumber = invoice.get('referenceNumber')
-}
-partyId = null
-if (invoice.get('invoiceTypeId') == 'PURCHASE_INVOICE'
- || invoice.getRelatedOne('InvoiceType', false).get('parentTypeId') == 'PURCHASE_INVOICE') {
- partyId = invoice.get('partyIdFrom')
-} else {
- partyId = invoice.get('partyId')
-}
-partyName = ''
-partyNameView = from('PartyNameView').where('partyId', partyId).queryOne()
-if (partyNameView.get('firstName')) {
- partyName += partyNameView.get('firstName') + ' '
-}
-if (partyNameView.get('lastName')) {
- partyName += partyNameView.get('lastName') + ' '
-}
-if (partyNameView.get('groupName')) {
- partyName += partyNameView.get('groupName') + ' '
-}
-
-orderBy = UtilMisc.toList('acctgTransId', 'acctgTransEntrySeqId')
-conds = []
-conds.add(EntityCondition.makeCondition('invoiceId', EntityOperator.EQUALS, invoiceId))
-conds.add(EntityCondition.makeCondition('paymentId', EntityOperator.EQUALS, null))
-invoiceAcctgTransAndEntries = delegator.findList('AcctgTransAndEntries', EntityCondition.makeCondition(conds), null, orderBy, null, false)
-context.invoiceAcctgTransAndEntries = invoiceAcctgTransAndEntries
-context.partyName = partyName
-context.partyId = partyId
diff --git a/applications/accounting/groovyScripts/reports/MonthSelection.groovy b/applications/accounting/groovyScripts/reports/MonthSelection.groovy
deleted file mode 100644
index eca2c93c9c..0000000000
--- a/applications/accounting/groovyScripts/reports/MonthSelection.groovy
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.service.calendar.ExpressionUiHelper
-
-if (parameters.selectedMonth) {
- selectedMonth = Integer.valueOf(parameters.selectedMonth)
- selectedMonthDate = UtilDateTime.toTimestamp((selectedMonth + 1), 1, UtilDateTime.getYear(UtilDateTime.nowTimestamp(), timeZone, locale), 0, 0, 0)
- context.fromDate = UtilDateTime.getMonthStart(selectedMonthDate, timeZone, locale)
- context.thruDate = UtilDateTime.getMonthEnd(selectedMonthDate, timeZone, locale)
-}
-context.monthList = ExpressionUiHelper.getMonthValueList(locale)
diff --git a/applications/accounting/groovyScripts/reports/SalesInvoiceByProductCategorySummary.groovy b/applications/accounting/groovyScripts/reports/SalesInvoiceByProductCategorySummary.groovy
deleted file mode 100644
index 3c0bb28c15..0000000000
--- a/applications/accounting/groovyScripts/reports/SalesInvoiceByProductCategorySummary.groovy
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.base.util.UtilMisc
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-
-//NOTE: this code ignores from/thru dates on the products and categories under the rootProductCategoryId!
-
-//TODO_MAYBE: variant product support for products in category, and product shown directly (should we really do this?)
-//TODO:
-
-// get products and categories under the root category
-productMemberList = from('ProductCategoryMember').where('productCategoryId', rootProductCategoryId).orderBy('sequenceNum').queryList()
-categoryRollupList = from('ProductCategoryRollup').where('parentProductCategoryId', rootProductCategoryId).orderBy('sequenceNum').queryList()
-
-// for use in the queries
-productIdSet = []
-productCategoryIdSet = []
-
-// for use in the templates
-productList = []
-productCategoryList = []
-
-productMemberList.each { productMember ->
- if (!productIdSet.contains(productMember.productId)) {
- productList.add(productMember.getRelatedOne('Product', true))
- }
- productIdSet.add(productMember.productId)
-}
-categoryRollupList.each { categoryRollup ->
- if (!productCategoryIdSet.contains(categoryRollup.productCategoryId)) {
- productCategoryList.add(categoryRollup.getRelatedOne('CurrentProductCategory', true))
- }
- productCategoryIdSet.add(categoryRollup.productCategoryId)
-}
-
-//NOTE: tax, etc also have productId on them, so restrict by type INV_PROD_ITEM, INV_FPROD_ITEM, INV_DPROD_ITEM, others?
-baseProductAndExprs = []
-baseProductAndExprs.add(EntityCondition.makeCondition('invoiceTypeId', EntityOperator.EQUALS, 'SALES_INVOICE'))
-baseProductAndExprs.add(EntityCondition.makeCondition('invoiceItemTypeId', EntityOperator.IN, ['INV_PROD_ITEM', 'INV_FPROD_ITEM', 'INV_DPROD_ITEM']))
-baseProductAndExprs.add(EntityCondition.makeCondition('statusId', EntityOperator.IN, ['INVOICE_READY', 'INVOICE_PAID']))
-if (organizationPartyId) {
- baseProductAndExprs.add(EntityCondition.makeCondition('partyIdFrom', EntityOperator.EQUALS, organizationPartyId))
-}
-if (currencyUomId) {
- baseProductAndExprs.add(EntityCondition.makeCondition('currencyUomId', EntityOperator.EQUALS, currencyUomId))
-}
-
-baseCategoryAndExprs = []
-baseCategoryAndExprs.add(EntityCondition.makeCondition('invoiceTypeId', EntityOperator.EQUALS, 'SALES_INVOICE'))
-baseCategoryAndExprs.add(EntityCondition.makeCondition('invoiceItemTypeId', EntityOperator.IN, ['INV_PROD_ITEM', 'INV_FPROD_ITEM', 'INV_DPROD_ITEM']))
-baseCategoryAndExprs.add(EntityCondition.makeCondition('statusId', EntityOperator.IN, ['INVOICE_READY', 'INVOICE_PAID']))
-if (productCategoryIdSet) {
- baseCategoryAndExprs.add(EntityCondition.makeCondition('productCategoryId', EntityOperator.IN, productCategoryIdSet))
-}
-if (productIdSet) {
- baseCategoryAndExprs.add(EntityCondition.makeCondition('productId', EntityOperator.NOT_IN, productIdSet))
-}
-if (organizationPartyId) {
- baseCategoryAndExprs.add(EntityCondition.makeCondition('partyIdFrom', EntityOperator.EQUALS, organizationPartyId))
-}
-if (currencyUomId) {
- baseCategoryAndExprs.add(EntityCondition.makeCondition('currencyUomId', EntityOperator.EQUALS, currencyUomId))
-}
-
-// get the Calendar object for the current month (specifed by month, year Integer values in the context)
-monthCal = Calendar.getInstance()
-monthCal.set(Calendar.YEAR, year)
-monthCal.set(Calendar.MONTH, (month - 1))
-
-nextMonthCal = Calendar.getInstance()
-nextMonthCal.setTimeInMillis(monthCal.getTimeInMillis())
-nextMonthCal.add(Calendar.MONTH, 1)
-
-// iterate through the days and do the queries
-productResultMapByDayList = []
-productNullResultByDayList = []
-categoryResultMapByDayList = []
-
-monthProductResultMap = [:]
-monthCategoryResultMap = [:]
-monthProductNullResult = [:]
-
-daysInMonth = monthCal.getActualMaximum(Calendar.DAY_OF_MONTH)
-for (int currentDay = 0; currentDay <= daysInMonth; currentDay++) {
- currentDayCal = Calendar.getInstance()
- currentDayCal.setTimeInMillis(monthCal.getTimeInMillis())
- currentDayCal.set(Calendar.DAY_OF_MONTH, currentDay)
- currentDayBegin = new java.sql.Timestamp(currentDayCal.getTimeInMillis())
- currentDayCal.add(Calendar.DAY_OF_MONTH, 1)
- nextDayBegin = new java.sql.Timestamp(currentDayCal.getTimeInMillis())
-
- // do the product find
- productAndExprs = []
- productAndExprs.addAll(baseProductAndExprs)
- if (productIdSet) {
- productAndExprs.add(EntityCondition.makeCondition('productId', EntityOperator.IN, productIdSet))
- }
- productAndExprs.add(EntityCondition.makeCondition('invoiceDate', EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin))
- productAndExprs.add(EntityCondition.makeCondition('invoiceDate', EntityOperator.LESS_THAN, nextDayBegin))
-
- productResultListIterator = select('productId', 'quantityTotal', 'amountTotal')
- .from('InvoiceItemProductSummary').where(productAndExprs).cursorScrollInsensitive().cache(true).queryIterator()
- productResultMap = [:]
- while (productResultListIterator.hasNext()) {
- productResult = productResultListIterator.next()
- productResultMap[productResult.productId] = productResult
- monthProductResult = UtilMisc.getMapFromMap(monthProductResultMap, productResult.productId)
- UtilMisc.addToBigDecimalInMap(monthProductResult, 'quantityTotal', productResult.getBigDecimal('quantityTotal'))
- UtilMisc.addToBigDecimalInMap(monthProductResult, 'amountTotal', productResult.getBigDecimal('amountTotal'))
- }
- productResultListIterator.close()
- productResultMapByDayList.add(productResultMap)
-
- // do the category find
- categoryAndExprs = []
- categoryAndExprs.addAll(baseCategoryAndExprs)
- categoryAndExprs.add(EntityCondition.makeCondition('invoiceDate', EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin))
- categoryAndExprs.add(EntityCondition.makeCondition('invoiceDate', EntityOperator.LESS_THAN, nextDayBegin))
-
- categoryResultListIterator = select('productCategoryId', 'quantityTotal', 'amountTotal')
- .from('InvoiceItemCategorySummary').where(categoryAndExprs).cursorScrollInsensitive().cache(true).queryIterator()
- categoryResultMap = [:]
- while (categoryResultListIterator.hasNext()) {
- categoryResult = categoryResultListIterator.next()
- categoryResultMap[categoryResult.productCategoryId] = categoryResult
- monthCategoryResult = UtilMisc.getMapFromMap(monthCategoryResultMap, categoryResult.productCategoryId)
- UtilMisc.addToBigDecimalInMap(monthCategoryResult, 'quantityTotal', categoryResult.getBigDecimal('quantityTotal'))
- UtilMisc.addToBigDecimalInMap(monthCategoryResult, 'amountTotal', categoryResult.getBigDecimal('amountTotal'))
- }
- categoryResultListIterator.close()
- categoryResultMapByDayList.add(categoryResultMap)
-
- // do a find for InvoiceItem with a null productId
- productNullAndExprs = []
- productNullAndExprs.addAll(baseProductAndExprs)
- productNullAndExprs.add(EntityCondition.makeCondition('productId', EntityOperator.EQUALS, null))
- productNullAndExprs.add(EntityCondition.makeCondition('invoiceDate', EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin))
- productNullAndExprs.add(EntityCondition.makeCondition('invoiceDate', EntityOperator.LESS_THAN, nextDayBegin))
- productNullResultListIterator = select('productId', 'quantityTotal', 'amountTotal')
- .from('InvoiceItemProductSummary').where(productNullAndExprs).cursorScrollInsensitive().cache(true).queryIterator()
- // should just be 1 result
- productNullResult = productNullResultListIterator.next()
- productNullResultListIterator.close()
- if (productNullResult) {
- productNullResultByDayList.add(productNullResult)
- UtilMisc.addToBigDecimalInMap(monthProductNullResult, 'quantityTotal', productNullResult.getBigDecimal('quantityTotal'))
- UtilMisc.addToBigDecimalInMap(monthProductNullResult, 'amountTotal', productNullResult.getBigDecimal('amountTotal'))
- } else {
- // no result, add an empty Map place holder
- productNullResultByDayList.add([:])
- }
-}
-
-context.productResultMapByDayList = productResultMapByDayList
-context.productNullResultByDayList = productNullResultByDayList
-context.categoryResultMapByDayList = categoryResultMapByDayList
-
-context.monthProductResultMap = monthProductResultMap
-context.monthCategoryResultMap = monthCategoryResultMap
-context.monthProductNullResult = monthProductNullResult
-
-context.productCategoryList = productCategoryList
-context.productList = productList
diff --git a/applications/accounting/groovyScripts/reports/TransactionTotals.groovy b/applications/accounting/groovyScripts/reports/TransactionTotals.groovy
deleted file mode 100644
index 5d09577ef7..0000000000
--- a/applications/accounting/groovyScripts/reports/TransactionTotals.groovy
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.accounting.util.UtilAccounting
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilMisc
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-
-import java.sql.Timestamp
-
-if (!fromDate) {
- return
-}
-thruDate = thruDate ?: UtilDateTime.nowTimestamp()
-if (!glFiscalTypeId) {
- return
-}
-
-// Find the last closed time period to get the fromDate for the transactions in the current period and the ending balances of the last closed period
-Map lastClosedTimePeriodResult = runService('findLastClosedDate',
- ['organizationPartyId': parameters.get('ApplicationDecorator|organizationPartyId'), 'findDate': fromDate, 'userLogin': userLogin])
-Timestamp lastClosedDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate
-GenericValue lastClosedTimePeriod = null
-if (lastClosedDate) {
- lastClosedTimePeriod = (GenericValue)lastClosedTimePeriodResult.lastClosedTimePeriod
-}
-
-// POSTED
-// Posted transactions totals and grand totals
-postedTotals = []
-postedTotalDebit = BigDecimal.ZERO
-postedTotalCredit = BigDecimal.ZERO
-andExprs = []
-andExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
-andExprs.add(EntityCondition.makeCondition('isPosted', EntityOperator.EQUALS, 'Y'))
-andExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
-List postedTransactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(andExprs).orderBy('glAccountId').queryList()
-if (postedTransactionTotals) {
- Map postedTransactionTotalsMap = [:]
- postedTransactionTotals.each { postedTransactionTotal ->
- Map accountMap = (Map)postedTransactionTotalsMap.get(postedTransactionTotal.glAccountId)
- if (!accountMap) {
- GenericValue glAccount = from('GlAccount').where('glAccountId', postedTransactionTotal.glAccountId).cache(true).queryOne()
- if (glAccount) {
- // Get the opening balances at the end of the last closed time period
- if (UtilAccounting.isAssetAccount(glAccount) || UtilAccounting.isLiabilityAccount(glAccount)
- || UtilAccounting.isEquityAccount(glAccount)) {
- if (lastClosedTimePeriod) {
- lastTimePeriodHistory = from('GlAccountAndHistory')
- .where('organizationPartyId', parameters.get('ApplicationDecorator|organizationPartyId'),
- 'glAccountId', postedTransactionTotal.glAccountId, 'customTimePeriodId',
- lastClosedTimePeriod.customTimePeriodId).queryFirst()
- if (lastTimePeriodHistory) {
- accountMap = UtilMisc.toMap('glAccountId', lastTimePeriodHistory.glAccountId,
- 'accountCode', lastTimePeriodHistory.accountCode, 'accountName', lastTimePeriodHistory.accountName,
- 'balance', lastTimePeriodHistory.getBigDecimal('endingBalance'),
- 'openingD', lastTimePeriodHistory.getBigDecimal('postedDebits'),
- 'openingC', lastTimePeriodHistory.getBigDecimal('postedCredits'),
- 'D', BigDecimal.ZERO, 'C', BigDecimal.ZERO)
- }
- }
- }
- }
- if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(postedTransactionTotal)
- accountMap.put('openingD', BigDecimal.ZERO)
- accountMap.put('openingC', BigDecimal.ZERO)
- accountMap.put('D', BigDecimal.ZERO)
- accountMap.put('C', BigDecimal.ZERO)
- accountMap.put('balance', BigDecimal.ZERO)
- }
- //
- List mainAndExprs = []
- mainAndExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
- mainAndExprs.add(EntityCondition.makeCondition('isPosted', EntityOperator.EQUALS, 'Y'))
- mainAndExprs.add(EntityCondition.makeCondition('glAccountId', EntityOperator.EQUALS, postedTransactionTotal.glAccountId))
- mainAndExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId))
- mainAndExprs.add(EntityCondition.makeCondition('acctgTransTypeId', EntityOperator.NOT_EQUAL, 'PERIOD_CLOSING'))
- mainAndExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate))
- mainAndExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN, fromDate))
- transactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(mainAndExprs).orderBy('glAccountId').queryList()
- transactionTotals.each { transactionTotal ->
- UtilMisc.addToBigDecimalInMap(accountMap, 'opening' + transactionTotal.debitCreditFlag, transactionTotal.amount)
- }
- }
- UtilMisc.addToBigDecimalInMap(accountMap, postedTransactionTotal.debitCreditFlag, postedTransactionTotal.amount)
- postedTransactionTotalsMap.put(postedTransactionTotal.glAccountId, accountMap)
- }
- postedTotals = postedTransactionTotalsMap.values().asList()
-}
-// Posted grand total for Debits
-andExprs = []
-andExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
-andExprs.add(EntityCondition.makeCondition('isPosted', EntityOperator.EQUALS, 'Y'))
-andExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId))
-andExprs.add(EntityCondition.makeCondition('debitCreditFlag', EntityOperator.EQUALS, 'D'))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
-List postedDebitTransactionTotals = select('amount').from('AcctgTransEntrySums').where(andExprs).queryList()
-if (postedDebitTransactionTotals) {
- postedDebitTransactionTotal = postedDebitTransactionTotals.first()
- if (postedDebitTransactionTotal && postedDebitTransactionTotal.amount) {
- postedTotalDebit = postedDebitTransactionTotal.amount
- }
-}
-// Posted grand total for Credits
-andExprs = []
-andExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
-andExprs.add(EntityCondition.makeCondition('isPosted', EntityOperator.EQUALS, 'Y'))
-andExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId))
-andExprs.add(EntityCondition.makeCondition('debitCreditFlag', EntityOperator.EQUALS, 'C'))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
-List postedCreditTransactionTotals = select('amount').from('AcctgTransEntrySums').where(andExprs).queryList()
-if (postedCreditTransactionTotals) {
- postedCreditTransactionTotal = postedCreditTransactionTotals.first()
- if (postedCreditTransactionTotal && postedCreditTransactionTotal.amount) {
- postedTotalCredit = postedCreditTransactionTotal.amount
- }
-}
-postedTotals.add(['D': postedTotalDebit, 'C': postedTotalCredit])
-context.postedTransactionTotals = postedTotals
-
-// UNPOSTED
-// Unposted transactions totals and grand totals
-unpostedTotals = []
-unpostedTotalDebit = BigDecimal.ZERO
-unpostedTotalCredit = BigDecimal.ZERO
-andExprs = []
-andExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
-andExprs.add(EntityCondition.makeCondition('isPosted', EntityOperator.EQUALS, 'N'))
-andExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
-List unpostedTransactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(andExprs).orderBy('glAccountId').queryList()
-if (unpostedTransactionTotals) {
- Map unpostedTransactionTotalsMap = [:]
- unpostedTransactionTotals.each { unpostedTransactionTotal ->
- Map accountMap = (Map)unpostedTransactionTotalsMap.get(unpostedTransactionTotal.glAccountId)
- if (!accountMap) {
- GenericValue glAccount = from('GlAccount').where('glAccountId', unpostedTransactionTotal.glAccountId).cache(true).queryOne()
- if (glAccount) {
- // Get the opening balances at the end of the last closed time period
- if (UtilAccounting.isAssetAccount(glAccount) || UtilAccounting.isLiabilityAccount(glAccount)
- || UtilAccounting.isEquityAccount(glAccount)) {
- if (lastClosedTimePeriod) {
- lastTimePeriodHistory = from('GlAccountAndHistory').where('organizationPartyId',
- parameters.get('ApplicationDecorator|organizationPartyId'), 'glAccountId', unpostedTransactionTotal.glAccountId,
- 'customTimePeriodId', lastClosedTimePeriod.customTimePeriodId).queryFirst()
- if (lastTimePeriodHistory) {
- accountMap = UtilMisc.toMap('glAccountId', lastTimePeriodHistory.glAccountId,
- 'accountCode', lastTimePeriodHistory.accountCode, 'accountName', lastTimePeriodHistory.accountName,
- 'balance', lastTimePeriodHistory.getBigDecimal('endingBalance'),
- 'openingD', lastTimePeriodHistory.getBigDecimal('postedDebits'),
- 'openingC', lastTimePeriodHistory.getBigDecimal('postedCredits'),
- 'D', BigDecimal.ZERO, 'C', BigDecimal.ZERO)
- }
- }
- }
- }
- if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(unpostedTransactionTotal)
- accountMap.put('openingD', BigDecimal.ZERO)
- accountMap.put('openingC', BigDecimal.ZERO)
- accountMap.put('D', BigDecimal.ZERO)
- accountMap.put('C', BigDecimal.ZERO)
- accountMap.put('balance', BigDecimal.ZERO)
- }
- //
- List mainAndExprs = []
- mainAndExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
- mainAndExprs.add(EntityCondition.makeCondition('isPosted', EntityOperator.EQUALS, 'N'))
- mainAndExprs.add(EntityCondition.makeCondition('glAccountId', EntityOperator.EQUALS, unpostedTransactionTotal.glAccountId))
- mainAndExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId))
- mainAndExprs.add(EntityCondition.makeCondition('acctgTransTypeId', EntityOperator.NOT_EQUAL, 'PERIOD_CLOSING'))
- mainAndExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate))
- mainAndExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN, fromDate))
- transactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(mainAndExprs).orderBy('glAccountId').queryList()
- transactionTotals.each { transactionTotal ->
- UtilMisc.addToBigDecimalInMap(accountMap, 'opening' + transactionTotal.debitCreditFlag, transactionTotal.amount)
- }
- }
- UtilMisc.addToBigDecimalInMap(accountMap, unpostedTransactionTotal.debitCreditFlag, unpostedTransactionTotal.amount)
- unpostedTransactionTotalsMap.put(unpostedTransactionTotal.glAccountId, accountMap)
- }
- unpostedTotals = unpostedTransactionTotalsMap.values().asList()
-}
-// Unposted grand total for Debits
-andExprs = []
-andExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
-andExprs.add(EntityCondition.makeCondition('isPosted', EntityOperator.EQUALS, 'N'))
-andExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId))
-andExprs.add(EntityCondition.makeCondition('debitCreditFlag', EntityOperator.EQUALS, 'D'))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
-List unpostedDebitTransactionTotals = select('amount').from('AcctgTransEntrySums').where(andExprs).queryList()
-if (unpostedDebitTransactionTotals) {
- unpostedDebitTransactionTotal = unpostedDebitTransactionTotals.first()
- if (unpostedDebitTransactionTotal && unpostedDebitTransactionTotal.amount) {
- unpostedTotalDebit = unpostedDebitTransactionTotal.amount
- }
-}
-// Unposted grand total for Credits
-andExprs = []
-andExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
-andExprs.add(EntityCondition.makeCondition('isPosted', EntityOperator.EQUALS, 'N'))
-andExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId))
-andExprs.add(EntityCondition.makeCondition('debitCreditFlag', EntityOperator.EQUALS, 'C'))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
-List unpostedCreditTransactionTotals = select('amount').from('AcctgTransEntrySums').where(andExprs).queryList()
-if (unpostedCreditTransactionTotals) {
- unpostedCreditTransactionTotal = unpostedCreditTransactionTotals.first()
- if (unpostedCreditTransactionTotal && unpostedCreditTransactionTotal.amount) {
- unpostedTotalCredit = unpostedCreditTransactionTotal.amount
- }
-}
-unpostedTotals.add(['D': unpostedTotalDebit, 'C': unpostedTotalCredit])
-context.unpostedTransactionTotals = unpostedTotals
-
-// POSTED AND UNPOSTED
-// Posted and unposted transactions totals and grand totals
-allTotals = []
-allTotalDebit = BigDecimal.ZERO
-allTotalCredit = BigDecimal.ZERO
-andExprs = []
-andExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
-andExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
-List allTransactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(andExprs).orderBy('glAccountId').queryList()
-if (allTransactionTotals) {
- Map allTransactionTotalsMap = [:]
- allTransactionTotals.each { allTransactionTotal ->
- Map accountMap = (Map)allTransactionTotalsMap.get(allTransactionTotal.glAccountId)
- if (!accountMap) {
- GenericValue glAccount = from('GlAccount').where('glAccountId', allTransactionTotal.glAccountId).cache(true).queryOne()
- if (glAccount) {
- // Get the opening balances at the end of the last closed time period
- if (UtilAccounting.isAssetAccount(glAccount) || UtilAccounting.isLiabilityAccount(glAccount)
- || UtilAccounting.isEquityAccount(glAccount)) {
- if (lastClosedTimePeriod) {
- List timePeriodAndExprs = []
- timePeriodAndExprs.add(
- EntityCondition.makeCondition('organizationPartyId', parameters.get('ApplicationDecorator|organizationPartyId')))
- timePeriodAndExprs.add(EntityCondition.makeCondition('glAccountId', allTransactionTotal.glAccountId))
- timePeriodAndExprs.add(EntityCondition.makeCondition('customTimePeriodId', lastClosedTimePeriod.customTimePeriodId))
- lastTimePeriodHistory = from('GlAccountAndHistory').where(timePeriodAndExprs).queryFirst()
- if (lastTimePeriodHistory) {
- accountMap = UtilMisc.toMap('glAccountId', lastTimePeriodHistory.glAccountId,
- 'accountCode', lastTimePeriodHistory.accountCode, 'accountName', lastTimePeriodHistory.accountName,
- 'balance', lastTimePeriodHistory.getBigDecimal('endingBalance'),
- 'openingD', lastTimePeriodHistory.getBigDecimal('postedDebits'),
- 'openingC', lastTimePeriodHistory.getBigDecimal('postedCredits'),
- 'D', BigDecimal.ZERO, 'C', BigDecimal.ZERO)
- }
- }
- }
- }
- if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(allTransactionTotal)
- accountMap.put('openingD', BigDecimal.ZERO)
- accountMap.put('openingC', BigDecimal.ZERO)
- accountMap.put('D', BigDecimal.ZERO)
- accountMap.put('C', BigDecimal.ZERO)
- accountMap.put('balance', BigDecimal.ZERO)
- }
- //
- List mainAndExprs = []
- mainAndExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
- mainAndExprs.add(EntityCondition.makeCondition('isPosted', EntityOperator.EQUALS, 'N'))
- mainAndExprs.add(EntityCondition.makeCondition('glAccountId', EntityOperator.EQUALS, allTransactionTotal.glAccountId))
- mainAndExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId))
- mainAndExprs.add(EntityCondition.makeCondition('acctgTransTypeId', EntityOperator.NOT_EQUAL, 'PERIOD_CLOSING'))
- mainAndExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate))
- mainAndExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN, fromDate))
- transactionTotals = select('glAccountId', 'accountName', 'accountCode', 'debitCreditFlag', 'amount')
- .from('AcctgTransEntrySums').where(mainAndExprs).orderBy('glAccountId').queryList()
- transactionTotals.each { transactionTotal ->
- UtilMisc.addToBigDecimalInMap(accountMap, 'opening' + transactionTotal.debitCreditFlag, transactionTotal.amount)
- }
- }
- UtilMisc.addToBigDecimalInMap(accountMap, allTransactionTotal.debitCreditFlag, allTransactionTotal.amount)
- allTransactionTotalsMap.put(allTransactionTotal.glAccountId, accountMap)
- }
- allTotals = allTransactionTotalsMap.values().asList()
-}
-// Posted and unposted grand total for Debits
-andExprs = []
-andExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
-andExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId))
-andExprs.add(EntityCondition.makeCondition('debitCreditFlag', EntityOperator.EQUALS, 'D'))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
-List allDebitTransactionTotals = select('amount').from('AcctgTransEntrySums').where(andExprs).queryList()
-if (allDebitTransactionTotals) {
- allDebitTransactionTotal = allDebitTransactionTotals.first()
- if (allDebitTransactionTotal && allDebitTransactionTotal.amount) {
- allTotalDebit = allDebitTransactionTotal.amount
- }
-}
-// Posted and unposted grand total for Credits
-andExprs = []
-andExprs.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
-andExprs.add(EntityCondition.makeCondition('glFiscalTypeId', EntityOperator.EQUALS, glFiscalTypeId))
-andExprs.add(EntityCondition.makeCondition('debitCreditFlag', EntityOperator.EQUALS, 'C'))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
-andExprs.add(EntityCondition.makeCondition('transactionDate', EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
-List allCreditTransactionTotals = select('amount').from('AcctgTransEntrySums').where(andExprs).queryList()
-if (allCreditTransactionTotals) {
- allCreditTransactionTotal = allCreditTransactionTotals.first()
- if (allCreditTransactionTotal && allCreditTransactionTotal.amount) {
- allTotalCredit = allCreditTransactionTotal.amount
- }
-}
-allTotals.add(['D': allTotalDebit, 'C': allTotalCredit])
-context.allTransactionTotals = allTotals
diff --git a/applications/accounting/groovyScripts/reports/TrialBalance.groovy b/applications/accounting/groovyScripts/reports/TrialBalance.groovy
deleted file mode 100644
index 57cc99db5c..0000000000
--- a/applications/accounting/groovyScripts/reports/TrialBalance.groovy
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-import org.apache.ofbiz.party.party.PartyHelper
-
-partyNameList = []
-parties.each { party ->
- partyName = PartyHelper.getPartyName(party)
- partyNameList.add(partyName)
-}
-context.partyNameList = partyNameList
-
-if (parameters.customTimePeriodId) {
- customTimePeriod = from('CustomTimePeriod').where('customTimePeriodId', parameters.customTimePeriodId).cache(true).queryOne()
- exprList = []
- exprList.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
- exprList.add(EntityCondition.makeCondition('fromDate', EntityOperator.LESS_THAN, customTimePeriod.getTimestamp('thruDate')))
- exprList.add(EntityCondition.makeCondition(
- EntityCondition.makeCondition('thruDate', EntityOperator.GREATER_THAN_EQUAL_TO, customTimePeriod.getTimestamp('fromDate')),
- EntityOperator.OR, EntityCondition.makeCondition('thruDate', EntityOperator.EQUALS, null)))
- List organizationGlAccounts = from('GlAccountOrganizationAndClass').where(exprList).orderBy('accountCode').queryList()
-
- accountBalances = []
- postedDebitsTotal = 0
- postedCreditsTotal = 0
- organizationGlAccounts.each { organizationGlAccount ->
- accountBalance = [:]
- accountBalance = runService('computeGlAccountBalanceForTimePeriod',
- [organizationPartyId: organizationGlAccount.organizationPartyId,
- customTimePeriodId: customTimePeriod.customTimePeriodId, glAccountId: organizationGlAccount.glAccountId])
- if (accountBalance.postedDebits != 0 || accountBalance.postedCredits != 0) {
- accountBalance.glAccountId = organizationGlAccount.glAccountId
- accountBalance.accountCode = organizationGlAccount.accountCode
- accountBalance.accountName = organizationGlAccount.accountName
- postedDebitsTotal = postedDebitsTotal + accountBalance.postedDebits
- postedCreditsTotal = postedCreditsTotal + accountBalance.postedCredits
- accountBalances.add(accountBalance)
- }
- }
- context.postedDebitsTotal = postedDebitsTotal
- context.postedCreditsTotal = postedCreditsTotal
- context.accountBalances = accountBalances
-}
diff --git a/applications/accounting/groovyScripts/transaction/AuthorizeTransaction.groovy b/applications/accounting/groovyScripts/transaction/AuthorizeTransaction.groovy
deleted file mode 100644
index 710baa519d..0000000000
--- a/applications/accounting/groovyScripts/transaction/AuthorizeTransaction.groovy
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-import org.apache.ofbiz.order.order.OrderReadHelper
-
-orderId = context.orderId
-orderPaymentPreferenceId = context.orderPaymentPreferenceId
-
-if ((!orderId) || (!orderPaymentPreferenceId)) {
- return
-}
-
-if (orderId) {
- orderHeader = from('OrderHeader').where('orderId', orderId).queryOne()
- context.orderHeader = orderHeader
-}
-
-if (orderHeader) {
- orh = new OrderReadHelper(orderHeader)
- context.orh = orh
- context.overrideAmount = orh.getOrderGrandTotal()
-}
-
-if (orderPaymentPreferenceId) {
- orderPaymentPreference = from('OrderPaymentPreference').where('orderPaymentPreferenceId', orderPaymentPreferenceId).queryOne()
- context.orderPaymentPreference = orderPaymentPreference
-}
-
-if (orderPaymentPreference) {
- paymentMethodType = orderPaymentPreference.getRelatedOne('PaymentMethodType', true)
- context.paymentMethodType = paymentMethodType
- context.overrideAmount = orderPaymentPreference.getBigDecimal('maxAmount')
-}
diff --git a/applications/accounting/groovyScripts/transaction/CaptureTransaction.groovy b/applications/accounting/groovyScripts/transaction/CaptureTransaction.groovy
deleted file mode 100644
index 5a5a37a16e..0000000000
--- a/applications/accounting/groovyScripts/transaction/CaptureTransaction.groovy
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-import org.apache.ofbiz.entity.util.EntityUtil
-
-orderId = context.orderId
-orderPaymentPreferenceId = context.orderPaymentPreferenceId
-
-if ((!orderId) || (!orderPaymentPreferenceId)) {
- return
-}
-
-if (orderId) {
- orderHeader = from('OrderHeader').where('orderId', orderId).queryOne()
- context.orderHeader = orderHeader
-}
-
-if (orderPaymentPreferenceId) {
- orderPaymentPreference = from('OrderPaymentPreference').where('orderPaymentPreferenceId', orderPaymentPreferenceId).queryOne()
- context.orderPaymentPreference = orderPaymentPreference
-}
-
-if (orderPaymentPreference) {
- paymentMethodType = orderPaymentPreference.getRelatedOne('PaymentMethodType', true)
- context.paymentMethodType = paymentMethodType
-}
-
-if (orderPaymentPreference) {
- context.paymentTypeId = 'CUSTOMER_PAYMENT'
-}
-
-if (orderPaymentPreference) {
- // we retrieve the captureAmount by looking at the latest authorized gateway response for this orderPaymentPreference
- gatewayResponses = orderPaymentPreference.getRelated('PaymentGatewayResponse', null, ['transactionDate DESC'], false)
- EntityUtil.filterByCondition(gatewayResponses, EntityCondition.makeCondition('transCodeEnumId', EntityOperator.EQUALS, 'PGT_AUTHORIZE'))
-
- if (gatewayResponses) { // TODO: some kind of error telling user to re-authorize (else part)
- latestAuth = gatewayResponses[0]
- context.captureAmount = latestAuth.getBigDecimal('amount')
- }
-}
diff --git a/applications/accounting/groovyScripts/transaction/ViewGatewayResponse.groovy b/applications/accounting/groovyScripts/transaction/ViewGatewayResponse.groovy
deleted file mode 100644
index cd3475fc72..0000000000
--- a/applications/accounting/groovyScripts/transaction/ViewGatewayResponse.groovy
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/*
- * The first purpose of this script is to retrieve the orderId and paymentPreferenceId of this gateway response. It is
- * activated if orderPaymentPreferenceId is not supplied.
- *
- * The second purpose of this script is to determine the gateway response of a given capture or authorize action.
- * To activate this behavior, pass in an orderPaymentPreferenceId. It will set the orderId in the context so that
- * a backlink to the order can be created.
- */
-
-import org.apache.ofbiz.entity.condition.EntityCondition
-import org.apache.ofbiz.entity.condition.EntityOperator
-import org.apache.ofbiz.entity.util.EntityUtil
-
-// get this field first, it determines which purpose this script satisfies
-orderPaymentPreferenceId = context.orderPaymentPreferenceId
-
-// first purpose: retrieve orderId and paymentPreferenceId
-if (orderPaymentPreferenceId) {
- // second purpose: grab the latest gateway response of the orderpaymentpreferenceId
- orderPaymentPreference = from('OrderPaymentPreference').where('orderPaymentPreferenceId', orderPaymentPreferenceId).queryOne()
- gatewayResponses = orderPaymentPreference.getRelated('PaymentGatewayResponse', null, ['transactionDate DESC'], false)
- EntityUtil.filterByCondition(gatewayResponses, EntityCondition.makeCondition('transCodeEnumId', EntityOperator.EQUALS, 'PGT_AUTHORIZE'))
-
- if (gatewayResponses) { // TODO: some kind of error telling user to re-authorize (else part)
- latestAuth = gatewayResponses[0]
- context.paymentGatewayResponse = latestAuth
- }
-
- context.orderId = orderPaymentPreference.orderId
-} else {
- paymentGatewayResponse = context.paymentGatewayResponse
- orderPaymentPreference = paymentGatewayResponse.getRelatedOne('OrderPaymentPreference', false)
- context.orderId = orderPaymentPreference.orderId
- context.orderPaymentPreferenceId = orderPaymentPreference.orderPaymentPreferenceId
-}
-// get the list of payments associated to gateway response
-if (context.paymentGatewayResponse) {
- context.payments = context.paymentGatewayResponse.getRelated('Payment', null, null, false)
-}
diff --git a/applications/accounting/servicedef/services_admin.xml b/applications/accounting/servicedef/services_admin.xml
index 6a522b7841..e18ab22bea 100644
--- a/applications/accounting/servicedef/services_admin.xml
+++ b/applications/accounting/servicedef/services_admin.xml
@@ -25,7 +25,7 @@ under the License.
<version>1.0</version>
<service name="createPartyAcctgPreference" default-entity-name="PartyAcctgPreference" engine="groovy"
- location="component://accounting/groovyScripts/admin/AcctgAdminServices.groovy" invoke="createPartyAcctgPreference" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy" invoke="createPartyAcctgPreference" auth="true">
<description>Create accounting preferences for a party (organization)</description>
<permission-service service-name="acctgPrefPermissionCheck" main-action="CREATE"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
@@ -74,7 +74,7 @@ under the License.
</service>
<service name="getPartyAccountingPreferences" default-entity-name="PartyAcctgPreference" engine="groovy"
- location="component://accounting/groovyScripts/admin/AcctgAdminServices.groovy" invoke="getPartyAccountingPreferences" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy" invoke="getPartyAccountingPreferences" auth="true">
<description>Get accounting preferences for a party (organization)</description>
<permission-service service-name="acctgPrefPermissionCheck" main-action="VIEW"/>
<attribute type="String" mode="IN" name="organizationPartyId" optional="false"/>
@@ -82,14 +82,14 @@ under the License.
</service>
<service name="setAcctgCompany" engine="groovy"
- location="component://accounting/groovyScripts/admin/AcctgAdminServices.groovy" invoke="setAcctgCompany" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy" invoke="setAcctgCompany" auth="true">
<description>Set Accounting Company when select</description>
<permission-service service-name="acctgPrefPermissionCheck" main-action="VIEW"/>
<attribute type="String" mode="INOUT" name="organizationPartyId" optional="true"/>
</service>
<service name="updateFXConversion" engine="groovy"
- location="component://accounting/groovyScripts/admin/AcctgAdminServices.groovy" invoke="updateFXConversion">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy" invoke="updateFXConversion">
<description>Update the conversion rate between two currencies and expire the old conversion rates</description>
<permission-service service-name="acctgFxPermissionCheck" main-action="UPDATE"/>
<attribute type="String" mode="IN" name="uomId" optional="false"/>
@@ -145,7 +145,7 @@ under the License.
</service>
<service name="getFXConversion" engine="groovy"
- location="component://accounting/groovyScripts/admin/AcctgAdminServices.groovy" invoke="getFXConversion">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy" invoke="getFXConversion">
<description>get the conversion rate</description>
<attribute type="String" mode="IN" name="uomId" optional="false"/>
<attribute type="String" mode="IN" name="uomIdTo" optional="false"/>
diff --git a/applications/accounting/servicedef/services_agreement.xml b/applications/accounting/servicedef/services_agreement.xml
index df335ab489..5129b16ddb 100644
--- a/applications/accounting/servicedef/services_agreement.xml
+++ b/applications/accounting/servicedef/services_agreement.xml
@@ -44,7 +44,7 @@ under the License.
<auto-attributes include="pk" mode="IN" optional="false"/>
</service>
<service name="copyAgreement" default-entity-name="Agreement" engine="groovy"
- location="component://accounting/groovyScripts/agreement/AgreementServices.groovy" invoke="copyAgreement" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/agreement/AgreementServices.groovy" invoke="copyAgreement" auth="true">
<description>Copy an Agreement</description>
<permission-service service-name="acctgAgreementPermissionCheck" main-action="CREATE"/>
<auto-attributes include="pk" mode="INOUT" optional="false"/>
diff --git a/applications/accounting/servicedef/services_budget.xml b/applications/accounting/servicedef/services_budget.xml
index ba66cd2bba..040749f0f7 100644
--- a/applications/accounting/servicedef/services_budget.xml
+++ b/applications/accounting/servicedef/services_budget.xml
@@ -43,7 +43,7 @@ under the License.
<auto-attributes include="nonpk" mode="IN" optional="true"/>
</service>
<service name="updateBudgetStatus" default-entity-name="BudgetStatus" engine="groovy"
- location="component://accounting/groovyScripts/budget/BudgetServices.groovy" invoke="updateBudgetStatus" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/budget/BudgetServices.groovy" invoke="updateBudgetStatus" auth="true">
<description>Update a Budget</description>
<auto-attributes include="pk" mode="IN" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
diff --git a/applications/accounting/servicedef/services_cost.xml b/applications/accounting/servicedef/services_cost.xml
index 36a7afdb09..40b627face 100644
--- a/applications/accounting/servicedef/services_cost.xml
+++ b/applications/accounting/servicedef/services_cost.xml
@@ -82,7 +82,7 @@ under the License.
</service>
<service name="updateProductAverageCostOnReceiveInventory" default-entity-name="ProductAverageCost" engine="groovy"
- location="component://product/groovyScripts/product/cost/CostServices.groovy" invoke="updateProductAverageCostOnReceiveInventory" auth="true">
+ location="component://product/src/main/groovy/org/apache/ofbiz/product/product/cost/CostServices.groovy" invoke="updateProductAverageCostOnReceiveInventory" auth="true">
<description>Update a Product Average Cost record on receive inventory</description>
<permission-service service-name="acctgCostPermissionCheck" main-action="UPDATE"/>
<attribute name="facilityId" type="String" mode="IN" optional="false"/>
@@ -92,7 +92,7 @@ under the License.
</service>
<service name="getProductAverageCost" engine="groovy"
- location="component://product/groovyScripts/product/cost/CostServices.groovy" invoke="getProductAverageCost" auth="true">
+ location="component://product/src/main/groovy/org/apache/ofbiz/product/product/cost/CostServices.groovy" invoke="getProductAverageCost" auth="true">
<description>Get Average cost of a product</description>
<attribute name="inventoryItem" type="org.apache.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
<attribute name="unitCost" type="BigDecimal" mode="OUT" optional="false"/>
diff --git a/applications/accounting/servicedef/services_invoice.xml b/applications/accounting/servicedef/services_invoice.xml
index e923967dff..776e095c0f 100644
--- a/applications/accounting/servicedef/services_invoice.xml
+++ b/applications/accounting/servicedef/services_invoice.xml
@@ -26,7 +26,7 @@ under the License.
<service name="getNextInvoiceId" engine="groovy"
- location="component://accounting/groovyScripts/invoice/InvoiceServices.groovy" invoke="getNextInvoiceId">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServices.groovy" invoke="getNextInvoiceId">
<description>Get the Next Invoice ID According to Settings on the PartyAcctgPreference Entity for the given Party</description>
<implements service="createInvoice"/>
<attribute name="partyId" type="String" mode="IN" optional="false"/>
@@ -34,14 +34,14 @@ under the License.
</service>
<service name="invoiceSequenceEnforced" engine="groovy"
- location="component://accounting/groovyScripts/invoice/InvoiceServices.groovy" invoke="invoiceSequenceEnforced">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServices.groovy" invoke="invoiceSequenceEnforced">
<implements service="getNextInvoiceId"/>
<attribute name="partyAcctgPreference" type="org.apache.ofbiz.entity.GenericValue" mode="IN"/>
<override name="invoiceId" type="Long" mode="OUT"/>
</service>
<service name="invoiceSequenceRestart" engine="groovy"
- location="component://accounting/groovyScripts/invoice/InvoiceServices.groovy" invoke="invoiceSequenceRestart">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServices.groovy" invoke="invoiceSequenceRestart">
<implements service="getNextInvoiceId"/>
<attribute name="partyAcctgPreference" type="org.apache.ofbiz.entity.GenericValue" mode="IN"/>
</service>
diff --git a/applications/accounting/servicedef/services_ledger.xml b/applications/accounting/servicedef/services_ledger.xml
index d9c9f74317..2464a4bb95 100644
--- a/applications/accounting/servicedef/services_ledger.xml
+++ b/applications/accounting/servicedef/services_ledger.xml
@@ -194,7 +194,7 @@ under the License.
</service>
<!-- AcctgTrans services -->
<service name="createAcctgTrans" default-entity-name="AcctgTrans" engine="groovy" auth="true"
- location="component://accounting/groovyScripts/ledger/GeneralLedgerServices.groovy" invoke="createAcctgTrans" >
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/ledger/GeneralLedgerServices.groovy" invoke="createAcctgTrans" >
<description>Create a AcctgTrans record with isPosted set to "N"</description>
<permission-service service-name="acctgTransactionPermissionCheck" main-action="CREATE"/>
<implements service="interfaceAcctgTrans"/>
diff --git a/applications/accounting/servicedef/services_payment.xml b/applications/accounting/servicedef/services_payment.xml
index 3c3125e2e1..842929a0db 100644
--- a/applications/accounting/servicedef/services_payment.xml
+++ b/applications/accounting/servicedef/services_payment.xml
@@ -26,7 +26,7 @@ under the License.
<!-- Payment services -->
<service name="createPayment" engine="groovy" default-entity-name="Payment"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="createPayment" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="createPayment" auth="true">
<description>Create a Payment. If a paymentMethodId is supplied, paymentMethodTypeId is gotten from paymentMethod. Otherwise, it must be supplied. If no
paymentMethodTypeId and no paymentMethodId is supplied, then an error will be returned. </description>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
@@ -38,14 +38,14 @@ under the License.
</service>
<service name="updatePayment" engine="groovy" default-entity-name="Payment"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="updatePayment" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="updatePayment" auth="true">
<description>Update a Payment</description>
<auto-attributes include="pk" mode="IN" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
</service>
<service name="setPaymentStatus" engine="groovy" default-entity-name="Payment"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="setPaymentStatus" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="setPaymentStatus" auth="true">
<description>Change the status of a Payment</description>
<permission-service service-name="acctgPaymentPermissionCheck" main-action="UPDATE"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
@@ -60,14 +60,14 @@ under the License.
</service>
<service name="quickSendPayment" engine="groovy" default-entity-name="Payment"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="quickSendPayment">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="quickSendPayment">
<description>Updates a Payment and then marks it as PMNT_SENT</description>
<auto-attributes include="pk" mode="IN" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
</service>
<service name="createPaymentApplication" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="createPaymentApplication" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="createPaymentApplication" auth="true">
<description>Create a payment application</description>
<attribute name="paymentId" type="String" mode="IN" optional="false"/>
<attribute name="toPaymentId" type="String" mode="IN" optional="true"/>
@@ -109,7 +109,7 @@ under the License.
</service>
<service name="createPaymentAndApplication" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="createPaymentAndApplication" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="createPaymentAndApplication" auth="true">
<description>Create a payment and a payment application for the full amount</description>
<auto-attributes entity-name="Payment" include="nonpk" mode="IN" optional="true"/>
<auto-attributes entity-name="Payment" include="pk" mode="INOUT" optional="true"/>
@@ -127,14 +127,14 @@ under the License.
</service>
<service name="getInvoicePaymentInfoList" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="getInvoicePaymentInfoList" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="getInvoicePaymentInfoList" auth="true">
<description>Create a list with information on payment due dates and amounts for the invoice; one of invoiceId or invoice must be provided.</description>
<attribute name="invoiceId" type="String" mode="IN" optional="true"/>
<attribute name="invoice" type="org.apache.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
<attribute name="invoicePaymentInfoList" type="List" mode="OUT" optional="false"/>
</service>
<service name="getInvoicePaymentInfoListByDueDateOffset" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="getInvoicePaymentInfoListByDueDateOffset" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="getInvoicePaymentInfoListByDueDateOffset" auth="true">
<description>Create a list with information on payment due dates and amounts.</description>
<attribute name="invoiceTypeId" type="String" mode="IN" optional="false"/>
<attribute name="daysOffset" type="Long" mode="IN" optional="false"/>
@@ -143,7 +143,7 @@ under the License.
<attribute name="invoicePaymentInfoList" type="List" mode="OUT" optional="true"/>
</service>
<service name="voidPayment" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="voidPayment" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="voidPayment" auth="true">
<description>Sets payment status to PMNT_VOID, removes all PaymentApplications, changes related invoice statuses to
INVOICE_READY if status is INVOICE_PAID, and reverses related AcctgTrans by calling copyAcctgTransAndEntries service</description>
<permission-service service-name="acctgPaymentPermissionCheck" main-action="UPDATE"/>
@@ -152,19 +152,19 @@ under the License.
<attribute name="statusId" type="String" mode="OUT" optional="true"/>
</service>
<service name="getPaymentRunningTotal" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="getPaymentRunningTotal" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="getPaymentRunningTotal" auth="true">
<description>calculate running total for payments</description>
<attribute name="paymentIds" type="List" mode="IN" optional="false"/>
<attribute name="organizationPartyId" type="String" mode="IN" optional="true"/>
<attribute name="paymentRunningTotal" type="String" mode="OUT" optional="false"/>
</service>
<service name="cancelPaymentBatch" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="cancelPaymentBatch" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="cancelPaymentBatch" auth="true">
<description>cancel payment batch</description>
<attribute name="paymentGroupId" type="String" mode="IN" optional="false"/>
</service>
<service name="createPaymentAndPaymentGroupForInvoices" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="createPaymentAndPaymentGroupForInvoices" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="createPaymentAndPaymentGroupForInvoices" auth="true">
<description>Creates Payments, Payment Application and Payment Group for the same</description>
<attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
<attribute name="checkStartNumber" type="Long" mode="IN" optional="true"/>
@@ -174,7 +174,7 @@ under the License.
<attribute name="paymentGroupId" type="String" mode="OUT" optional="true"/>
</service>
<service name="createPaymentAndApplicationForParty" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="createPaymentAndApplicationForParty" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="createPaymentAndApplicationForParty" auth="true">
<description>create Payment and PaymentApplications for multiple invoices for one party</description>
<attribute name="organizationPartyId" type="String" mode="INOUT" optional="true"/>
<attribute name="partyId" type="String" mode="IN" optional="false"/>
@@ -188,7 +188,7 @@ under the License.
<attribute name="amount" type="BigDecimal" mode="OUT" optional="true"/>
</service>
<service name="createPaymentGroupAndMember" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="createPaymentGroupAndMember" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="createPaymentGroupAndMember" auth="true">
<attribute name="paymentIds" type="List" mode="IN" optional="false"/>
<attribute name="paymentGroupTypeId" type="String" mode="IN" optional="false"/>
<attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/>
@@ -196,38 +196,38 @@ under the License.
<attribute name="paymentGroupId" type="String" mode="OUT" optional="false"/>
</service>
<service name="cancelCheckRunPayments" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="cancelCheckRunPayments" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="cancelCheckRunPayments" auth="true">
<description>Cancel all payments for payment group</description>
<attribute name="paymentGroupId" type="String" mode="IN" optional="false"/>
</service>
<service name="createFinAccoutnTransFromPayment" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="createFinAccoutnTransFromPayment" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="createFinAccoutnTransFromPayment" auth="true">
<auto-attributes entity-name="FinAccountTrans" include="nonpk" mode="IN" optional="true"/>
<auto-attributes entity-name="FinAccountTrans" include="pk" mode="INOUT" optional="true"/>
<attribute name="invoiceIds" type="List" mode="IN" optional="true"/>
</service>
<service name="getPayments" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="getPayments" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="getPayments" auth="true">
<description>Get list of payment</description>
<attribute name="paymentGroupId" type="String" mode="IN" optional="true"/>
<attribute name="finAccountTransId" type="String" mode="IN" optional="true"/>
<attribute name="payments" type="List" mode="OUT" optional="true"/>
</service>
<service name="getPaymentGroupReconciliationId" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="getPaymentGroupReconciliationId" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="getPaymentGroupReconciliationId" auth="true">
<description>Get ReconciliationId associated to paymentGroup</description>
<attribute name="paymentGroupId" type="String" mode="IN" optional="false"/>
<attribute name="glReconciliationId" type="String" mode="OUT" optional="true"/>
</service>
<service name="checkAndCreateBatchForValidPayments" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="checkAndCreateBatchForValidPayments" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="checkAndCreateBatchForValidPayments" auth="true">
<description>Check the valid(unbatched) payment and create batch for same</description>
<implements service="createPaymentGroupAndMember"/>
</service>
<service name="massChangePaymentStatus" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="massChangePaymentStatus" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="massChangePaymentStatus" auth="true">
<description>Set status of Payments in bulk.</description>
<attribute name="paymentIds" type="List" mode="IN" optional="false"/>
<attribute name="statusId" type="String" mode="IN" optional="false"/>
@@ -235,7 +235,7 @@ under the License.
</service>
<service name="createPaymentFromOrder" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="createPaymentFromOrder" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="createPaymentFromOrder" auth="true">
<description>Create Payment from Order when payment does exist yet and not disabled by accounting config</description>
<attribute name="orderId" type="String" mode="IN" optional="false"/>
<attribute name="paymentId" type="String" mode="OUT" optional="true"/>
@@ -245,7 +245,7 @@ under the License.
</service>
<service name="createMatchingPaymentApplication" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="createMatchingPaymentApplication" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="createMatchingPaymentApplication" auth="true">
<description>Create a payment application if either the invoice of payment could be found</description>
<attribute name="paymentId" type="String" mode="IN" optional="true"/>
<attribute name="invoiceId" type="String" mode="IN" optional="true"/>
@@ -253,7 +253,7 @@ under the License.
<!-- Payment content services -->
<service name="createPaymentContent" default-entity-name="PaymentContent" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="createPaymentContent" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="createPaymentContent" auth="true">
<description>Add Content To Payment</description>
<auto-attributes include="pk" mode="INOUT" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
@@ -261,7 +261,7 @@ under the License.
<override name="fromDate" optional="true"/>
</service>
<service name="updatePaymentContent" default-entity-name="PaymentContent" engine="groovy"
- location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="updatePaymentContent" auth="true">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="updatePaymentContent" auth="true">
<description>Update Content To Payment</description>
<auto-attributes include="pk" mode="IN" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
diff --git a/applications/accounting/servicedef/services_rate.xml b/applications/accounting/servicedef/services_rate.xml
index 9822c554ff..9e11d31ccd 100644
--- a/applications/accounting/servicedef/services_rate.xml
+++ b/applications/accounting/servicedef/services_rate.xml
@@ -25,7 +25,7 @@ under the License.
<version>1.0</version>
<service name="updateRateAmount" default-entity-name="RateAmount" engine="groovy" auth="true"
- location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="updateRateAmount">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy" invoke="updateRateAmount">
<description>Create/update Rate Amount</description>
<permission-service service-name="acctgBasePermissionCheck" main-action="CREATE"/>
<auto-attributes include="all" mode="IN" optional="true"/>
@@ -37,7 +37,7 @@ under the License.
<override name="partyId" default-value="_NA_"/>
</service>
<service name="expireRateAmount" default-entity-name="RateAmount" engine="groovy" auth="true"
- location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="expireRateAmount">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy" invoke="expireRateAmount">
<description>expire Rate Amount</description>
<permission-service service-name="acctgBasePermissionCheck" main-action="CREATE"/>
<auto-attributes include="pk" mode="IN" optional="true"/>
@@ -49,7 +49,7 @@ under the License.
<override name="partyId" default-value="_NA_"/>
</service>
<service name="deleteRateAmount" default-entity-name="RateAmount" engine="groovy" auth="true"
- location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="deleteRateAmount">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy" invoke="deleteRateAmount">
<deprecated use-instead="expireRateAmount" since="Release 18.12"/>
<permission-service service-name="acctgBasePermissionCheck" main-action="CREATE"/>
<auto-attributes include="pk" mode="IN" optional="true"/>
@@ -57,7 +57,7 @@ under the License.
<override name="fromDate" optional="false"/>
</service>
<service name="getRateAmount" default-entity-name="RateAmount" engine="groovy" auth="true"
- location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="getRateAmount">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy" invoke="getRateAmount">
<description>Get Rate Amount</description>
<permission-service service-name="acctgBasePermissionCheck" main-action="VIEW"/>
<auto-attributes include="pk" mode="IN" optional="true"/>
@@ -69,7 +69,7 @@ under the License.
<override name="rateTypeId" optional="false"/>
</service>
<service name="getRatesAmountsFromWorkEffortId" default-entity-name="RateAmount" engine="groovy" auth="true"
- location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="getRatesAmountsFromWorkEffortId">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy" invoke="getRatesAmountsFromWorkEffortId">
<description>Get all Rates Amounts for a given workEffortId</description>
<permission-service service-name="acctgBasePermissionCheck" main-action="VIEW"/>
<auto-attributes include="pk" mode="IN" optional="true"/>
@@ -79,7 +79,7 @@ under the License.
<override name="workEffortId" optional="false"/>
</service>
<service name="getRatesAmountsFromPartyId" default-entity-name="RateAmount" engine="groovy" auth="true"
- location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="getRatesAmountsFromPartyId">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy" invoke="getRatesAmountsFromPartyId">
<description>Get all Rates Amounts for a given partyId</description>
<permission-service service-name="acctgBasePermissionCheck" main-action="VIEW"/>
<auto-attributes include="pk" mode="IN" optional="true"/>
@@ -89,7 +89,7 @@ under the License.
<override name="partyId" optional="false"/>
</service>
<service name="getRatesAmountsFromEmplPositionTypeId" default-entity-name="RateAmount" engine="groovy" auth="true"
- location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="getRatesAmountsFromEmplPositionTypeId">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy" invoke="getRatesAmountsFromEmplPositionTypeId">
<description>Get all Rates Amounts for a given emplPositionTypeId</description>
<permission-service service-name="acctgBasePermissionCheck" main-action="VIEW"/>
<auto-attributes include="pk" mode="IN" optional="true"/>
@@ -99,7 +99,7 @@ under the License.
<override name="emplPositionTypeId" optional="false"/>
</service>
<service name="filterRateAmountList" default-entity-name="RateAmount" engine="groovy" auth="true"
- location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="filterRateAmountList">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy" invoke="filterRateAmountList">
<description>Get the most specific non-empty Rate Amount list from a list of Rate Amount, given the input parameters :
workEffortId, partyId, emplPositionTypeId and rateTypeId</description>
<auto-attributes include="pk" mode="IN" optional="true"/>
@@ -110,7 +110,7 @@ under the License.
<!-- PartyRate Services -->
<service name="updatePartyRate" default-entity-name="PartyRate" engine="groovy" auth="true"
- location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="updatePartyRate">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy" invoke="updatePartyRate">
<description>Creates PartyRate</description>
<permission-service service-name="acctgBasePermissionCheck" main-action="CREATE"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
@@ -122,14 +122,14 @@ under the License.
<override name="fromDate" optional="true"/>
</service>
<service name="deletePartyRate" default-entity-name="PartyRate" engine="groovy" auth="true"
- location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="deletePartyRate">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy" invoke="deletePartyRate">
<description>Deletes PartyRate</description>
<permission-service service-name="acctgBasePermissionCheck" main-action="UPDATE"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
<attribute name="rateAmountFromDate" type="Timestamp" mode="IN" optional="true"/>
</service>
<service name="expirePartyRate" default-entity-name="PartyRate" engine="groovy" auth="true"
- location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="expirePartyRate">
+ location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy" invoke="expirePartyRate">
<description>Expire PartyRate and expire related rateAmount</description>
<permission-service service-name="acctgBasePermissionCheck" main-action="UPDATE"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAdminTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAdminTests.groovy
deleted file mode 100644
index 3295bf32f7..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAdminTests.groovy
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-class AutoAcctgAdminTests extends OFBizTestCase {
-
- AutoAcctgAdminTests(String name) {
- super(name)
- }
-
- void testGetFXConversion() {
- Map serviceCtx = [
- uomId: 'EUR',
- uomIdTo: 'USD',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('getFXConversion', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- }
-
- void testAddPaymentMethodTypeGlAssignment() {
- Map serviceCtx = [
- paymentMethodTypeId: 'GIFT_CARD',
- organizationPartyId: 'DEMO_COMPANY1',
- glAccountId: '999999',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('addPaymentMethodTypeGlAssignment', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue paymentMethodTypeGlAccount = from('PaymentMethodTypeGlAccount')
- .where('paymentMethodTypeId', 'GIFT_CARD',
- 'organizationPartyId', 'DEMO_COMPANY1')
- .queryOne()
- assert paymentMethodTypeGlAccount
- assert paymentMethodTypeGlAccount.glAccountId == '999999'
- }
-
- void testRemovePaymentTypeGlAssignment() {
- Map serviceCtx = [
- paymentTypeId: 'COMMISSION_PAYMENT',
- organizationPartyId: 'DEMO_COMPANY1',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('removePaymentTypeGlAssignment', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue paymentMethodTypeGlAccount = from('PaymentGlAccountTypeMap')
- .where('paymentTypeId', 'COMMISSION_PAYMENT',
- 'organizationPartyId', 'DEMO_COMPANY1')
- .queryOne()
- assert paymentMethodTypeGlAccount == null
- }
-
- void testCreatePartyAcctgPreference() {
- Map serviceCtx = [
- partyId: 'DEMO_COMPANY',
- refundPaymentMethodId: '9020',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createPartyAcctgPreference', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue partyAcctgPreference = from('PartyAcctgPreference')
- .where('partyId', 'DEMO_COMPANY')
- .queryOne()
- assert partyAcctgPreference
- assert partyAcctgPreference.partyId == 'DEMO_COMPANY'
- assert partyAcctgPreference.refundPaymentMethodId == '9020'
- }
-
- void testUpdatePartyAcctgPreference() {
- Map serviceCtx = [
- partyId: 'DEMO_COMPANY1',
- refundPaymentMethodId: '9020',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('updatePartyAcctgPreference', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue partyAcctgPreference = from('PartyAcctgPreference')
- .where('partyId', 'DEMO_COMPANY1')
- .queryOne()
- assert partyAcctgPreference
- assert partyAcctgPreference.refundPaymentMethodId == '9020'
- }
-
- void testGetPartyAccountingPreferences() {
- Map serviceCtx = [
- organizationPartyId: 'DEMO_COMPANY1',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('getPartyAccountingPreferences', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert serviceResult.partyAccountingPreference != null
- }
-
- void testSetAcctgCompany() {
- Map serviceCtx = [
- organizationPartyId: 'DEMO_COMPANY1',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('setAcctgCompany', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue userPreference = from('UserPreference')
- .where('userPrefValue', 'DEMO_COMPANY1')
- .queryFirst()
- assert userPreference
- assert userPreference.userPrefGroupTypeId == 'GLOBAL_PREFERENCES'
- assert userPreference.userPrefTypeId == 'ORGANIZATION_PARTY'
- }
-
- void testUpdateFXConversion() {
- Map serviceCtx = [
- uomId: 'INR',
- uomIdTo: 'USD',
- conversionFactor: 2.0,
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('updateFXConversion', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue uomConversionDated = from('UomConversionDated')
- .where('uomId', 'INR', 'uomIdTo', 'USD')
- .queryFirst()
- assert uomConversionDated
- assert uomConversionDated.conversionFactor == 2.0
- }
-
- void testCreateGlAccountTypeDefault() {
- Map serviceCtx = [
- glAccountTypeId: 'BALANCE_ACCOUNT',
- organizationPartyId: 'DEMO_COMPANY1',
- glAccountId: '999999',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createGlAccountTypeDefault', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue glAccountTypeDefault = from('GlAccountTypeDefault')
- .where('glAccountTypeId', 'BALANCE_ACCOUNT', 'organizationPartyId', 'DEMO_COMPANY1')
- .queryOne()
- assert glAccountTypeDefault
- assert glAccountTypeDefault.glAccountId == '999999'
- }
-
- void testRemoveGlAccountTypeDefault() {
- Map serviceCtx = [
- glAccountTypeId: 'ACCOUNTS_PAYABLE',
- organizationPartyId: 'DEMO_COMPANY1',
- glAccountId: '999999',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('removeGlAccountTypeDefault', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue glAccountTypeDefault = from('GlAccountTypeDefault')
- .where('glAccountTypeId', 'ACCOUNTS_PAYABLE',
- 'organizationPartyId', 'DEMO_COMPANY1')
- .queryOne()
- assert glAccountTypeDefault == null
- }
-
- void testAddInvoiceItemTypeGlAssignment() {
- Map serviceCtx = [
- invoiceItemTypeId: 'PINV_FPROD_ITEM',
- organizationPartyId: 'DEMO_COMPANY1',
- glAccountId: '999999',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('addInvoiceItemTypeGlAssignment', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue invoiceItemTypeGlAccount = from('InvoiceItemTypeGlAccount')
- .where('invoiceItemTypeId', 'PINV_FPROD_ITEM',
- 'organizationPartyId', 'DEMO_COMPANY1')
- .queryOne()
- assert invoiceItemTypeGlAccount
- assert invoiceItemTypeGlAccount.glAccountId == '999999'
- }
-
- void testRemoveInvoiceItemTypeGlAssignment() {
- Map serviceCtx = [
- invoiceItemTypeId: 'PINV_SALES_TAX',
- organizationPartyId: 'DEMO_COMPANY1',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('removeInvoiceItemTypeGlAssignment', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue invoiceItemTypeGlAccount = from('InvoiceItemTypeGlAccount')
- .where('invoiceItemTypeId', 'PINV_SALES_TAX',
- 'organizationPartyId', 'DEMO_COMPANY1')
- .queryOne()
- assert invoiceItemTypeGlAccount == null
- }
-
- void testAddPaymentTypeGlAssignment() {
- Map serviceCtx = [
- paymentTypeId: 'TAX_PAYMENT',
- organizationPartyId: 'DEMO_COMPANY1',
- glAccountTypeId: 'TAX_ACCOUNT',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('addPaymentTypeGlAssignment', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue paymentGlAccountTypeMap = from('PaymentGlAccountTypeMap')
- .where('paymentTypeId', 'TAX_PAYMENT',
- 'organizationPartyId', 'DEMO_COMPANY1')
- .queryOne()
- assert paymentGlAccountTypeMap
- assert paymentGlAccountTypeMap.glAccountTypeId == 'TAX_ACCOUNT'
- }
-
- void testRemovePaymentMethodTypeGlAssignment() {
- Map serviceCtx = [
- paymentMethodTypeId: 'CASH',
- organizationPartyId: 'DEMO_COMPANY1',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('removePaymentMethodTypeGlAssignment', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue paymentMethodTypeGlAccount = from('PaymentMethodTypeGlAccount')
- .where('paymentMethodTypeId', 'CASH',
- 'organizationPartyId', 'DEMO_COMPANY1')
- .queryOne()
- assert paymentMethodTypeGlAccount == null
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAgreementTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAgreementTests.groovy
deleted file mode 100644
index 3fcacc4b46..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAgreementTests.groovy
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-class AutoAcctgAgreementTests extends OFBizTestCase {
-
- AutoAcctgAgreementTests(String name) {
- super(name)
- }
-
- void testAddPaymentMethodTypeGlAssignment() {
- Map serviceCtx = [
- agreementId: '1000',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('expireAgreement', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue agreement = from('Agreement')
- .where('agreementId', '1000')
- .filterByDate()
- .queryOne()
- assert agreement == null
- }
-
- void testCopyAgreement() {
- Map serviceCtx = [
- agreementId: '1010',
- copyAgreementTerms: 'N',
- copyAgreementProducts: 'Y',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('copyAgreement', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue agreement = from('Agreement')
- .where('agreementId', serviceResult.agreementId)
- .queryOne()
- List<GenericValue> agreementItems = agreement.getRelated('AgreementItem', null, null, false)
- List<GenericValue> agreementTerms = agreement.getRelated('AgreementTerm', null, null, false)
- List<GenericValue> agreementProductAppls = agreement.getRelated('AgreementProductAppl', null, null, false)
-
- assert agreement
- assert agreementItems
- assert agreementTerms?.isEmpty()
- assert agreementProductAppls
- }
-
- void testGetCommissionForProduct() {
- Map serviceCtx = [
- productId: 'TestProduct2',
- invoiceItemSeqId: 'COMM_INV_ITEM',
- invoiceItemTypeId: 'COMM_INV_ITEM',
- amount: 100.00,
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('getCommissionForProduct', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- List<Map<String, Object>> commissions = serviceResult.commissions
- Map<String, Object> commission = commissions?.first()
-
- assert commission
- assert commission.commission == 10.00
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgBudgetTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgBudgetTests.groovy
deleted file mode 100644
index 137538dd91..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgBudgetTests.groovy
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-class AutoAcctgBudgetTests extends OFBizTestCase {
-
- AutoAcctgBudgetTests(String name) {
- super(name)
- }
-
- void testCreateBudget() {
- Map serviceCtx = [:]
- serviceCtx.budgetTypeId = 'CAPITAL_BUDGET'
- serviceCtx.comments = 'Capital Budget'
- serviceCtx.userLogin = userLogin
- Map result = dispatcher.runSync('createBudget', serviceCtx)
- assert ServiceUtil.isSuccess(result)
-
- GenericValue budget = from('Budget').where(result).queryOne()
- assert budget
- assert budget.budgetTypeId == 'CAPITAL_BUDGET'
- assert budget.comments == 'Capital Budget'
- }
-
- void testUpdateBudgetStatus() {
- Map serviceCtx = [:]
- serviceCtx.budgetId = '9999'
- serviceCtx.statusId = 'BG_APPROVED'
- serviceCtx.userLogin = userLogin
- dispatcher.runSync('updateBudgetStatus', serviceCtx)
-
- List<GenericValue> budgetStatuses = from('BudgetStatus').where('budgetId', '9999').orderBy('-statusDate').queryList()
- assert ! budgetStatuses?.isEmpty()
- assert budgetStatuses[0].statusId == 'BG_APPROVED'
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgCostTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgCostTests.groovy
deleted file mode 100644
index 8e83c01216..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgCostTests.groovy
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-class AutoAcctgCostTests extends OFBizTestCase {
-
- AutoAcctgCostTests(String name) {
- super(name)
- }
-
- void testUpdateProductAverageCostOnReceiveInventory() {
- Map serviceCtx = [:]
- serviceCtx.facilityId = 'DemoFacility1'
- serviceCtx.quantityAccepted = new BigDecimal('10')
- serviceCtx.productId = 'TestProduct3'
- serviceCtx.inventoryItemId = '9999'
- serviceCtx.userLogin = userLogin
- Map result = dispatcher.runSync('updateProductAverageCostOnReceiveInventory', serviceCtx)
- assert ServiceUtil.isSuccess(result)
-
- GenericValue productAverageCost = from('ProductAverageCost').filterByDate()
- .where('productId', 'TestProduct3', 'facilityId', 'DemoFacility1').queryFirst()
- assert productAverageCost
- assert productAverageCost.productAverageCostTypeId == 'SIMPLE_AVG_COST'
- assert productAverageCost.averageCost == 9
- }
-
- void testGetProductAverageCost() {
- GenericValue inventoryItem = from('InventoryItem')
- .where('inventoryItemId', '9999').queryOne()
- Map serviceCtx = [
- inventoryItem: inventoryItem,
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('getProductAverageCost', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- assert serviceResult.unitCost == 9
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgFinAccountTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgFinAccountTests.groovy
deleted file mode 100644
index c5c7f2ef00..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgFinAccountTests.groovy
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-class AutoAcctgFinAccountTests extends OFBizTestCase {
-
- AutoAcctgFinAccountTests(String name) {
- super(name)
- }
-
- void testCreateFinAccount() {
- Map serviceCtx = [
- finAccountId: '1000',
- finAccountTypeId: 'BANK_ACCOUNT',
- finAccountName: 'Bank Account',
- finAccountCode: '1000',
- currencyUomId: 'USD',
- organizationPartyId: 'DEMO_COMPANY',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createFinAccount', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue finAccount = from('FinAccount')
- .where('finAccountId', '1000', 'finAccountTypeId', 'BANK_ACCOUNT')
- .queryOne()
- assert finAccount
- assert finAccount.finAccountCode == '1000'
- }
-
- void testUpdateFinAccount() {
- Map serviceCtx = [
- finAccountId: '1001',
- organizationPartyId: 'DEMO_COMPANY2',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('updateFinAccount', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue finAccount = from('FinAccount')
- .where('finAccountId', '1001')
- .queryOne()
- assert finAccount
- assert finAccount.organizationPartyId == 'DEMO_COMPANY2'
- }
-
- void testDeleteFinAccount() {
- Map serviceCtx = [
- finAccountId: '1002',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('deleteFinAccount', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue finAccount = from('FinAccount')
- .where('finAccountId', '1002')
- .queryOne()
- assert finAccount.thruDate != null
- }
-
- void testCreateFinAccountRole() {
- Map serviceCtx = [
- finAccountId: '1003',
- partyId: 'DEMO_COMPANY',
- roleTypeId: 'INTERNAL_ORGANIZATIO',
- fromDate: UtilDateTime.nowTimestamp(),
- currencyUomId: 'USD',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createFinAccountRole', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue finAccountRole = from('FinAccountRole')
- .where('finAccountId', '1003', 'partyId', 'DEMO_COMPANY', 'roleTypeId', 'INTERNAL_ORGANIZATIO')
- .queryFirst()
- assert finAccountRole
- }
-
- void testUpdateFinAccountRole() {
- Map serviceCtx = [
- finAccountId: '1004',
- partyId: 'DEMO_COMPANY',
- roleTypeId: 'SUPPLIER',
- fromDate: UtilDateTime.toTimestamp('11/03/2016 00:00:00'),
- thruDate: UtilDateTime.nowTimestamp(),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('updateFinAccountRole', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue finAccountRole = from('FinAccountRole')
- .where('finAccountId', '1004', 'partyId', 'DEMO_COMPANY', 'roleTypeId', 'SUPPLIER')
- .queryFirst()
- assert finAccountRole
- assert finAccountRole.thruDate != null
- }
-
- void testDeleteFinAccountRole() {
- Map serviceCtx = [
- finAccountId: '1004',
- partyId: 'DEMO_COMPANY',
- roleTypeId: 'SUPPLIER',
- fromDate: UtilDateTime.toTimestamp('11/03/2016 00:00:00'),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('deleteFinAccountRole', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue finAccountRole = from('FinAccountRole')
- .where('finAccountId', '1004', 'partyId', 'DEMO_COMPANY', 'roleTypeId', 'SUPPLIER')
- .queryFirst()
- assert finAccountRole == null
- }
-
- void testCreateFinAccountTrans() {
- Map serviceCtx = [
- finAccountId: '1003',
- finAccountTransTypeId: 'ADJUSTMENT',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createFinAccountTrans', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue finAccountTran = from('FinAccountTrans')
- .where('finAccountId', '1003', 'finAccountTransTypeId', 'ADJUSTMENT')
- .queryFirst()
- assert finAccountTran
- }
-
- void testCreateFinAccountStatus() {
- Map serviceCtx = [
- finAccountId: '1003',
- statusId: 'FNACT_ACTIVE',
- statusDate: UtilDateTime.nowTimestamp(),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createFinAccountStatus', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue finAccountStatus = from('FinAccountStatus')
- .where('finAccountId', '1003', 'statusId', 'FNACT_ACTIVE')
- .queryFirst()
- assert finAccountStatus
- }
-
- void testCreateFinAccountAuth() {
- Map serviceCtx = [
- finAccountId: '1004',
- amount: new BigDecimal('100'),
- currencyUomId: 'USD',
- authorizationDate: UtilDateTime.nowTimestamp(),
- fromDate: UtilDateTime.nowTimestamp(),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createFinAccountAuth', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert serviceResult.finAccountAuthId != null
- }
-
- void testSetFinAccountTransStatus() {
- Map serviceCtx = [
- finAccountTransId: '1010',
- statusId: 'FINACT_TRNS_APPROVED',
- userLogin: userLogin
- ]
- GenericValue finAccountTrans = from('FinAccountTrans')
- .where('finAccountTransId', '1010')
- .queryOne()
- String oldStatusId = finAccountTrans.statusId
-
- Map serviceResult = dispatcher.runSync('setFinAccountTransStatus', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- finAccountTrans = from('FinAccountTrans')
- .where('finAccountTransId', '1010')
- .queryOne()
- assert finAccountTrans
- assert finAccountTrans.statusId == 'FINACT_TRNS_APPROVED'
- assert oldStatusId == 'FINACT_TRNS_CREATED'
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgFixedAssetTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgFixedAssetTests.groovy
deleted file mode 100644
index eddfd9fb01..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgFixedAssetTests.groovy
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-class AutoAcctgFixedAssetTests extends OFBizTestCase {
-
- AutoAcctgFixedAssetTests(String name) {
- super(name)
- }
-
- void testCreateFixedAssetMaint() {
- Map serviceCtx = [
- fixedAssetId: '1000',
- statusId: 'FAM_CREATED',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createFixedAssetMaint', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue fixedAssetMaint = from('FixedAssetMaint')
- .where('fixedAssetId', '1000')
- .queryFirst()
-
- assert fixedAssetMaint
- assert fixedAssetMaint.maintHistSeqId != null
- }
-
- void testCreateFixedAssetMeter() {
- Map serviceCtx = [
- fixedAssetId: '1000',
- productMeterTypeId: 'DISTANCE',
- readingDate: UtilDateTime.nowTimestamp(),
- meterValue: new BigDecimal('10'),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createFixedAssetMeter', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- GenericValue fixedAssetMeter = from('FixedAssetMeter')
- .where('fixedAssetId', '1000', 'productMeterTypeId', 'DISTANCE')
- .queryFirst()
- assert fixedAssetMeter
- assert fixedAssetMeter.meterValue == BigDecimal.TEN
- }
-
- void testCancelFixedAssetStdCost() {
- Map serviceCtx = [
- fixedAssetId: '1000',
- fixedAssetStdCostTypeId: 'SETUP_COST',
- fromDate: UtilDateTime.toTimestamp('11/03/2016 00:00:00'),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('cancelFixedAssetStdCost', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue fixedAssetStdCost = from('FixedAssetStdCost')
- .where('fixedAssetId', '1000', 'fixedAssetStdCostTypeId', 'SETUP_COST', 'fromDate', UtilDateTime.toTimestamp('11/03/2016 00:00:00'))
- .queryFirst()
-
- assert fixedAssetStdCost
- assert fixedAssetStdCost.thruDate != null
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgInvoiceTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgInvoiceTests.groovy
deleted file mode 100644
index 8d7822f1b3..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgInvoiceTests.groovy
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-import java.sql.Timestamp
-
-class AutoAcctgInvoiceTests extends OFBizTestCase {
-
- AutoAcctgInvoiceTests(String name) {
- super(name)
- }
-
- void testCreateInvoiceContent() {
- Map serviceCtx = [
- invoiceId: '1008',
- contentId: '1000',
- invoiceContentTypeId: 'COMMENTS',
- fromDate: UtilDateTime.nowTimestamp(),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createInvoiceContent', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue invoiceContent = from('InvoiceContent')
- .where('invoiceId', serviceResult.invoiceId,
- 'contentId', serviceResult.contentId,
- 'invoiceContentTypeId', serviceResult.invoiceContentTypeId)
- .queryFirst()
-
- assert invoiceContent.contentId == serviceResult.contentId
- }
- void testCreateSimpleTextContentForInvoice() {
- Map serviceCtx = [
- invoiceId: '1009',
- contentId: '1001',
- contentTypeId: 'DOCUMENT',
- invoiceContentTypeId: 'COMMENTS',
- text: 'Content for invoice # 1009',
- fromDate: UtilDateTime.nowTimestamp(),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createSimpleTextContentForInvoice', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue invoiceContent = from('InvoiceContent')
- .where('invoiceId', '1009',
- 'contentId', '1001',
- 'invoiceContentTypeId', 'COMMENTS')
- .queryFirst()
-
- assert invoiceContent != null
- }
-
- void testCopyInvoice() {
- Map serviceCtx = [
- invoiceIdToCopyFrom: '1000',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('copyInvoice', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- assert serviceResult.invoiceId != null
- }
-
- void testCreateInvoice() {
- Map serviceCtx = [
- invoiceTypeId: 'PURCHASE_INVOICE',
- partyIdFrom: 'DEMO_COMPANY',
- partyId: 'DEMO_COMPANY1',
- invoiceDate: UtilDateTime.nowTimestamp(),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createInvoice', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- assert serviceResult.invoiceId != null
- }
-
- void testGetInvoice() {
- Map serviceCtx = [
- invoiceId: '1001',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('getInvoice', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- assert serviceResult.invoice != null
- assert serviceResult.invoiceItems != null
- }
-
- void testSetInvoiceStatus() {
- Map serviceCtx = [
- invoiceId: '1002',
- statusId: 'INVOICE_APPROVED',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('setInvoiceStatus', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue invoice = from('Invoice')
- .where('invoiceId', '1002')
- .queryOne()
-
- assert invoice != null
- assert invoice.statusId == 'INVOICE_APPROVED'
- }
-
- void testCopyInvoiceToTemplate() {
- Map serviceCtx = [
- invoiceId: '1002',
- invoiceTypeId: 'PURCHASE_INVOICE',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('copyInvoiceToTemplate', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- assert serviceResult.invoiceId != null
- }
-
- void testCreateInvoiceItem() {
- Map serviceCtx = [
- invoiceId: '1003',
- invoiceTypeId: 'PINV_FXASTPRD_ITEM',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createInvoiceItem', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- assert serviceResult.invoiceItemSeqId != null
- }
-
- void testCreateInvoiceStatus() {
- Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
- Map serviceCtx = [
- invoiceId: '1004',
- statusId: 'INVOICE_IN_PROCESS',
- statusDate: nowTimestamp,
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createInvoiceStatus', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue invoiceStatus = from('InvoiceStatus')
- .where('invoiceId', '1004',
- 'statusId', 'INVOICE_IN_PROCESS',
- 'statusDate', nowTimestamp)
- .queryOne()
-
- assert invoiceStatus != null
- }
-
- void testCreateInvoiceRole() {
- Map serviceCtx = [
- invoiceId: '1006',
- partyId: 'DEMO_COMPANY',
- roleTypeId: 'INTERNAL_ORGANIZATIO',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createInvoiceRole', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue invoiceRole = from('InvoiceRole')
- .where('invoiceId', '1006',
- 'partyId', 'DEMO_COMPANY',
- 'roleTypeId', 'INTERNAL_ORGANIZATIO')
- .queryOne()
-
- assert invoiceRole != null
- }
-
- void testCreateInvoiceTerm() {
- Map serviceCtx = [
- invoiceId: '1006',
- invoiceItemSeqId: '00001',
- termTypeId: 'FINANCIAL_TERM',
- termValue: 50.00,
- termDays: 10,
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createInvoiceTerm', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue invoiceTerm = from('InvoiceTerm')
- .where('invoiceTermId', serviceResult.invoiceTermId)
- .queryOne()
-
- assert invoiceTerm != null
- }
-
- void testCancelInvoice() {
- Map serviceCtx = [
- invoiceId: '1007',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('cancelInvoice', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert serviceResult.invoiceTypeId != null
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgLedgerTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgLedgerTests.groovy
deleted file mode 100644
index 1f23f4923a..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgLedgerTests.groovy
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-class AutoAcctgLedgerTests extends OFBizTestCase {
-
- AutoAcctgLedgerTests(String name) {
- super(name)
- }
- void testCreateAcctgTrans() {
- Map serviceCtx = [:]
- serviceCtx.acctgTransTypeId = 'CREDIT_MEMO'
- serviceCtx.description = 'Test Credit Memo Transaction'
- serviceCtx.transactionDate = UtilDateTime.nowTimestamp()
- serviceCtx.glFiscalTypeId = 'BUDGET'
- serviceCtx.userLogin = userLogin
- Map serviceResult = dispatcher.runSync('createAcctgTrans', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue acctgTrans = from('AcctgTrans').where('acctgTransId', serviceResult.acctgTransId).queryOne()
- assert acctgTrans.acctgTransId == serviceResult.acctgTransId
- assert acctgTrans.acctgTransTypeId == 'CREDIT_MEMO'
- }
- void testCreateAcctgTransEntry() {
- Map serviceCtx = [
- acctgTransId: '1000',
- organizationPartyId: 'DEMO_COMPANY',
- debitCreditFlag: 'C',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createAcctgTransEntry', serviceCtx)
- GenericValue acctgTransEntry = from('AcctgTransEntry')
- .where('acctgTransId', '1000', 'acctgTransEntrySeqId', serviceResult.acctgTransEntrySeqId).queryOne()
- assert acctgTransEntry != null
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentGatewayTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentGatewayTests.groovy
deleted file mode 100644
index 2531002f35..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentGatewayTests.groovy
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-class AutoAcctgPaymentGatewayTests extends OFBizTestCase {
-
- AutoAcctgPaymentGatewayTests(String name) {
- super(name)
- }
-
- void testUpdatePaymentGatewayConfig() {
- Map serviceCtx = [:]
- serviceCtx.paymentGatewayConfigId = 'SAGEPAY_CONFIG'
- serviceCtx.description = 'Test Payment Gateway Config Id'
- serviceCtx.userLogin = userLogin
- Map serviceResult = dispatcher.runSync('updatePaymentGatewayConfig', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue paymentGatewayConfig = from('PaymentGatewayConfig').where('paymentGatewayConfigId', 'SAGEPAY_CONFIG').queryOne()
- assert paymentGatewayConfig
- assert paymentGatewayConfig.description == 'Test Payment Gateway Config Id'
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy
deleted file mode 100644
index b1c1169c4a..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-import java.sql.Timestamp
-
-class AutoAcctgPaymentTests extends OFBizTestCase {
-
- AutoAcctgPaymentTests(String name) {
- super(name)
- }
- void testCreatePayment() {
- Map serviceCtx = [:]
- serviceCtx.paymentTypeId = 'CUSTOMER_PAYMENT'
- serviceCtx.partyIdFrom = 'Company'
- serviceCtx.partyIdTo = 'DemoCustCompany'
- serviceCtx.amount = 100.00
- serviceCtx.paymentMethodTypeId = 'COMPANY_CHECK'
- serviceCtx.userLogin = userLogin
- Map serviceResult = dispatcher.runSync('createPayment', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue payment = from('Payment').where('paymentId', serviceResult.paymentId).queryOne()
- assert payment.paymentTypeId == 'CUSTOMER_PAYMENT'
- assert payment.paymentMethodTypeId == 'COMPANY_CHECK'
- }
- void testSetPaymentStatus() {
- Map serviceCtx = [:]
- serviceCtx.paymentId = '1000'
- serviceCtx.statusId = 'PAYMENT_AUTHORIZED'
- serviceCtx.userLogin = userLogin
- Map serviceResult = dispatcher.runSync('setPaymentStatus', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue payment = from('Payment').where('paymentId', '1000').queryOne()
- assert payment
- assert serviceResult.oldStatusId == 'PAYMENT_NOT_AUTH'
- }
- void testQuickSendPayment() {
- Map serviceCtx = [:]
- serviceCtx.paymentId = '1001'
- serviceCtx.userLogin = userLogin
- Map serviceResult = dispatcher.runSync('quickSendPayment', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue payment = from('Payment').where('paymentId', '1001').queryOne()
- assert payment
- assert payment.statusId == 'PMNT_SENT'
- }
- void testGetPayments() {
- Map serviceCtx = [
- finAccountTransId: '1001',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('getPayments', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert serviceResult.payments != null
- }
- void testCreatePaymentContent() {
- Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
- Map serviceCtx = [
- paymentId: '1006',
- paymentContentTypeId: 'COMMENTS',
- contentId: '1006',
- fromDate: nowTimestamp,
- userLogin: userLogin
- ]
- dispatcher.runSync('createPaymentContent', serviceCtx)
- GenericValue paymentContent = from('PaymentContent')
- .where(paymentId: '1006', paymentContentTypeId: 'COMMENTS', contentId: '1006').filterByDate().queryFirst()
- assert paymentContent
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgTransTestsPurchase.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgTransTestsPurchase.groovy
deleted file mode 100644
index aae0a30033..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgTransTestsPurchase.groovy
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-class AutoAcctgTransTestsPurchase extends OFBizTestCase {
-
- AutoAcctgTransTestsPurchase(String name) {
- super(name)
- }
-
- // Test case for Accounting Transaction on Purchase
- void testAcctgTransOnPoReceipts() {
- /*
- Precondition : shipment is created from supplier and order items are issued
- create a purchase order using following:
- Supplier : DemoSupplier
- Item : WG-1111
- Quantity : 10
-
- Post condition : Credit in account 214000 - UNINVOICED ITEM RECEIPT amount = grand total of order.
- Debit in account 140000- INVENTORY amount = grand total of order.
- */
- String orderId = 'DEMO10091'
- String shipmentId = '9999'
- String productId = 'GZ-2644'
-
- Map serviceCtx = [
- inventoryItemTypeId: 'NON_SERIAL_INV_ITEM',
- productId: productId,
- facilityId: 'WebStoreWarehouse',
- quantityAccepted: new BigDecimal('5'),
- quantityRejected: new BigDecimal('0'),
- shipmentId: shipmentId,
- orderId: orderId,
- orderItemSeqId: '00001',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('receiveInventoryProduct', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue acctgTrans = from('AcctgTrans')
- .where('shipmentId', shipmentId)
- .queryFirst()
- assert acctgTrans
- assert acctgTrans.glJournalId != 'ERROR_JOURNAL'
-
- List<GenericValue> acctgTransEntryList = from('AcctgTransEntry')
- .where('acctgTransId', acctgTrans.acctgTransId, 'productId', productId)
- .queryList()
- assert acctgTransEntryList
-
- checkEntriesBalance(acctgTransEntryList)
-
- for (GenericValue acctgTransEntry : acctgTransEntryList) {
- if (acctgTransEntry.debitCreditFlag == 'C') {
- assert acctgTransEntry.glAccountTypeId == 'UNINVOICED_SHIP_RCPT'
- assert acctgTransEntry.glAccountId == '214000'
- } else if (acctgTransEntry.debitCreditFlag == 'D') {
- assert acctgTransEntry.glAccountTypeId == 'INVENTORY_ACCOUNT'
- assert acctgTransEntry.glAccountId == '140000'
- }
- }
-
- GenericValue orderItemBilling = from('OrderItemBilling')
- .where('orderId', orderId)
- .queryFirst()
- assert orderItemBilling
- }
-
- void testAcctgTransOnEditPoInvoice() {
- /*
- Precondition: To the Purchase Invoice created add taxes and two different shipping charges
- 1. for taxes: set "Invoice Item Type" = "Invoice Sales Tax" and "Unit Price" = 10$
- 2. for the first shipping charge: set "Invoice Item Type" = "Invoice Shipping And Handling" and "Unit Price" = 5$
- 3. for the second shipping charge: set "Invoice Item Type" = "Invoice Shipping And Handling",
- set "Override Gl Account Id" = "516100" and "Unit Price" = 5$
-
- Post condition: When status is set to ready, an accounting transaction is automatically posted to the GL:
- * Credit; in account 210000 - "ACCOUNTS PAYABLE"; amount: 290$
- * Debit; in account 214000 - "UNINVOICED ITEM RECEIPTS"; amount: 270$
- * Debit; in account 516100 - "PURCHASE ORDER ADJUSTMENTS"; amount: 10$
- * Debit; in account 510000 - "FREIGHT IN"; amount: 5$
- * Debit; in account 516100 - "PURCHASE ORDER ADJUSTMENTS"; amount: 5$
- */
- GenericValue orderItemBilling = from('OrderItemBilling')
- .where('orderId', 'DEMO10091')
- .queryFirst()
- assert orderItemBilling
-
- Map serviceCtx = [
- statusId: 'INVOICE_READY',
- invoiceId: orderItemBilling.invoiceId,
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('setInvoiceStatus', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue acctgTrans = from('AcctgTrans')
- .where('invoiceId', orderItemBilling.invoiceId)
- .queryFirst()
- assert acctgTrans
- assert acctgTrans.glJournalId != 'ERROR_JOURNAL'
-
- List<GenericValue> acctgTransEntryList = from('AcctgTransEntry')
- .where('acctgTransId', acctgTrans.acctgTransId)
- .queryList()
- assert acctgTransEntryList
-
- checkEntriesBalance(acctgTransEntryList)
-
- for (GenericValue acctgTransEntry : acctgTransEntryList) {
- if (acctgTransEntry.debitCreditFlag == 'C') {
- assert acctgTransEntry.glAccountTypeId == 'ACCOUNTS_PAYABLE'
- assert acctgTransEntry.glAccountId == '210000'
- }
- }
- }
-
- void testAcctgTransOnPaymentSentToSupplier() {
- /*
- Precondition: New payment is created for: supplierId = "DemoSupplier", "Payment Type ID" = "Vendor Payment" and
- a proper "Payment Method Type" (e.g. "Electronic Funds Transfer"), amount = $290
-
- Post condition: On payment's status is sent: a double-entry accounting transaction is automatically posted to the GL:
- * Credit; in account 111100 - "GENERAL CHECKING ACCOUNT"; amount: 290$; however this depends on the "Payment method type" selected;
- * Debit; in account 216000 - "ACCOUNTS PAYABLE - UNAPPLIED PAYMENTS"; amount: 290$
- */
- String paymentId = '9000'
-
- Map serviceCtx = [
- statusId: 'PMNT_SENT',
- paymentId: paymentId,
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('setPaymentStatus', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue acctgTrans = from('AcctgTrans')
- .where('paymentId', paymentId)
- .queryFirst()
- assert acctgTrans
- assert acctgTrans.glJournalId != 'ERROR_JOURNAL'
-
- List<GenericValue> acctgTransEntryList = from('AcctgTransEntry')
- .where('acctgTransId', acctgTrans.acctgTransId)
- .queryList()
- assert acctgTransEntryList
-
- checkEntriesBalance(acctgTransEntryList)
-
- for (GenericValue acctgTransEntry : acctgTransEntryList) {
- if (acctgTransEntry.debitCreditFlag == 'C') {
- assert acctgTransEntry.glAccountId == '111100'
- } else if (acctgTransEntry.debitCreditFlag == 'D') {
- assert acctgTransEntry.glAccountTypeId == 'ACCPAYABLE_UNAPPLIED'
- assert acctgTransEntry.glAccountId == '216000'
- }
- }
- }
-
- void checkEntriesBalance(List<GenericValue> acctgTransEntryList) {
- BigDecimal debitTotal = new BigDecimal('0')
- BigDecimal creditTotal = new BigDecimal('0')
-
- for (GenericValue acctgTransEntry : acctgTransEntryList) {
- if (acctgTransEntry.debitCreditFlag == 'C') {
- creditTotal = creditTotal.add(acctgTransEntry.origAmount)
- } else if (acctgTransEntry.debitCreditFlag == 'D') {
- debitTotal = debitTotal.add(acctgTransEntry.origAmount)
- }
- }
-
- assert debitTotal == creditTotal
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgTransTestsSales.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgTransTestsSales.groovy
deleted file mode 100644
index aae7864404..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgTransTestsSales.groovy
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.entity.util.EntityUtil
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-class AutoAcctgTransTestsSales extends OFBizTestCase {
-
- AutoAcctgTransTestsSales(String name) {
- super(name)
- }
-
- // Test case for Accounting Transaction on Sales
- void testAcctgTransForSalesOrderShipments() {
- /*
- Precondition :
- 1. create a sales order
- 2. from the order view screen, approve the order
- 3. from the order view screen, create a shipment to the customer
- (click on "New Shipment For Ship Group" and then click on the "Update" button in the next screen)
-
- Following process is tested by test case:
- 1. issue (assign) the order items to the shipment: select the "Order Items" tab and then click on "Issue All";
- this action will generate and post to the GL the accounting transaction for the items taken from the warehouse and ready to be shipped
-
- Post condition: all order items will be issued and it will generate and post to the GL the accounting transaction
- for the items taken from the warehouse and ready to be shipped
- * Credit; in account:140000 - Account Type:"INVENTORY_ACCOUNT"
- * Debit; in account:500000 - Account Type:"COGS_ACCOUNT"
- */
- String shipmentId = '9998'
-
- Map serviceCtx = [
- shipmentId: shipmentId,
- shipGroupSeqId: '00001',
- orderId: 'DEMO10090',
- orderItemSeqId: '00001',
- inventoryItemId: '9001',
- productId: 'GZ-2644',
- quantity: new BigDecimal('2'),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('issueOrderItemShipGrpInvResToShipment', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue acctgTrans = from('AcctgTrans')
- .where('shipmentId', shipmentId)
- .orderBy('-postedDate').queryFirst()
- assert acctgTrans
- assert acctgTrans.glJournalId != 'ERROR_JOURNAL'
-
- List<GenericValue> acctgTransEntryList = from('AcctgTransEntry')
- .where('acctgTransId', acctgTrans.acctgTransId)
- .queryList()
- assert acctgTransEntryList
-
- checkEntriesBalance(acctgTransEntryList)
-
- for (GenericValue acctgTransEntry : acctgTransEntryList) {
- if (acctgTransEntry.debitCreditFlag == 'C') {
- assert acctgTransEntry.glAccountTypeId == 'INVENTORY_ACCOUNT'
- assert acctgTransEntry.glAccountId == '140000'
- } else if (acctgTransEntry.debitCreditFlag == 'D') {
- assert acctgTransEntry.glAccountTypeId == 'COGS_ACCOUNT'
- assert acctgTransEntry.glAccountId == '500000'
- }
- }
- }
-
- void testAcctgTransOnSalesInvoice() {
- /*
- Precondition:
- 1. Create a sales order
- 2. From the order view screen, approve the order
- 3. From the order view screen, create a shipment to the customer
- (click on "New Shipment For Ship Group" and then click on the "Update" button in the next screen)
- 4. Issue the order items to the shipment: select the "Order Items" tab and then click on "Issue All."
- 5. From the shipment detail screen of the shipment created in the previous step
- (there is a link to it from the order detail screen), set the status of the shipment to "pack"
- (Click on "Edit" and then from statusId drop down select statusId = "Pack" and then click update);
- this action will generate a sales invoice
-
- Following process is tested by test case:
- 1. Go to the invoice detail screen (there is a link to the invoice from the order detail screen) and click on the "set status to ready";
- this action will generate and post to the GL the accounting transaction for the sales invoice
-
- Post condition: "Set status to ready"; This action will generate and post to the GL the accounting transaction for the sales invoice
- * Credit; in account=400000 - Account Type="SALES_ACCOUNT"
- * Debit; in account=120000 - Account Type="ACCOUNTS_RECEIVABLE"
-
- Note: The above notes seem to assume that you are going to manually follow the preconditions above before running this test.
- Instead the test will now use order DEMO10090 which currently preconditions 1-4 fulfilled, and we'll then update the
- shipment to the packed status (precondition 4). Additionally it doesn't seem to be necessary to set the invoice status
- to ready because the invoice is created in that state.
- */
- String shipmentId = '9998'
-
- Map serviceCtx = [
- shipmentId: shipmentId,
- statusId: 'SHIPMENT_PACKED',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('updateShipment', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue shipmentItemBilling = from('ShipmentItemBilling')
- .where('shipmentId', shipmentId)
- .orderBy('-createdStamp').queryFirst()
- assert shipmentItemBilling
-
- List<GenericValue> acctgTransList = from('AcctgTrans')
- .where('invoiceId', shipmentItemBilling.invoiceId)
- .queryList()
- assert acctgTransList
-
- // Check the invoice transaction
- GenericValue salesAcctgTrans = EntityUtil.getFirst(EntityUtil.filterByAnd(acctgTransList, [acctgTransTypeId: 'SALES_INVOICE']))
- assert salesAcctgTrans
- assert salesAcctgTrans.glJournalId != 'ERROR_JOURNAL'
-
- List<GenericValue> acctgTransEntryList = from('AcctgTransEntry')
- .where('acctgTransId', salesAcctgTrans.acctgTransId)
- .queryList()
- assert acctgTransEntryList
-
- checkEntriesBalance(acctgTransEntryList)
-
- List<GenericValue> accountsReceivableEntries = EntityUtil.filterByAnd(acctgTransEntryList,
- [glAccountTypeId: 'ACCOUNTS_RECEIVABLE', glAccountId: '120000'])
- assert accountsReceivableEntries
-
- List<GenericValue> salesAccountEntries = EntityUtil.filterByAnd(acctgTransEntryList, [glAccountId: '401000'])
- assert salesAccountEntries
-
- // Check the payment transaction
- GenericValue paymentAcctgTrans = EntityUtil.getFirst(EntityUtil.filterByAnd(acctgTransList, [acctgTransTypeId: 'PAYMENT_APPL']))
- assert paymentAcctgTrans
- assert paymentAcctgTrans.glJournalId != 'ERROR_JOURNAL'
-
- acctgTransEntryList.clear()
- acctgTransEntryList = from('AcctgTransEntry')
- .where('acctgTransId', paymentAcctgTrans.acctgTransId)
- .queryList()
- assert acctgTransEntryList
-
- checkEntriesBalance(acctgTransEntryList)
-
- accountsReceivableEntries.clear()
- accountsReceivableEntries = EntityUtil.filterByAnd(acctgTransEntryList, [glAccountTypeId: 'ACCOUNTS_RECEIVABLE', glAccountId: '120000'])
- assert accountsReceivableEntries
- }
-
- void testAcctgTransOnPaymentReceivedFromCustomer() {
- /*
- Precondition :-
- 1. Click on the Payment top menu in the Accounting application, then click on the "Create New Payment" link.
- 2. In the "New incoming payment" box, set the customer id in the "From Party ID" field; then set "Payment Type ID" = "Customer Payment"
- and a proper "Payment Method Type" (e.g. "Electronic Funds Transfer"); then set the "amount" and submit the form
-
- Following process is tested by test case:
- 1. From the payment detail screen, when you are ready to post the payment to the GL, click on the "Status to Received" link
-
- Post condition: "Status to Received", Received Payments. When you are ready to post the payment to the GL this action will generate
- and post to the GL the accounting transaction for the items taken from the warehouse and ready to be shipped:
- * Credit; in glAccountId=126000 - glAccountTypeId="ACCOUNTS_RECEIVABLE - UNAPPLIED PAYMENTS"
- * Debit; in glAccountId=112000 - glAccountTypeId="UNDEPOSITED_RECEIPTS"
- */
- GenericValue customerRole = from('PartyRole')
- .where('roleTypeId', 'CUSTOMER')
- .queryFirst()
- assert customerRole
-
- // Creating a payment from scratch rather than using the demo data
- Map serviceCtx = [
- partyIdFrom: customerRole.partyId,
- amount: new BigDecimal('100'),
- partyIdTo: 'Company',
- paymentMethodTypeId: 'EFT_ACCOUNT',
- paymentTypeId: 'CUSTOMER_PAYMENT',
- statusId: 'PMNT_RECEIVED',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createPayment', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue acctgTrans = from('AcctgTrans')
- .where('paymentId', serviceResult.paymentId, 'acctgTransTypeId', 'INCOMING_PAYMENT')
- .queryFirst()
- assert acctgTrans
- assert acctgTrans.glJournalId != 'ERROR_JOURNAL'
-
- List<GenericValue> acctgTransEntryList = from('AcctgTransEntry')
- .where('acctgTransId', acctgTrans.acctgTransId)
- .queryList()
- assert acctgTransEntryList
-
- checkEntriesBalance(acctgTransEntryList)
-
- for (GenericValue acctgTransEntry : acctgTransEntryList) {
- if (acctgTransEntry.debitCreditFlag == 'C') {
- assert acctgTransEntry.glAccountTypeId == 'ACCREC_UNAPPLIED'
- assert acctgTransEntry.glAccountId == '126000'
- } else if (acctgTransEntry.debitCreditFlag == 'D') {
- assert acctgTransEntry.glAccountId == '111100'
- }
- }
- }
-
- void checkEntriesBalance(List<GenericValue> acctgTransEntryList) {
- BigDecimal debitTotal = new BigDecimal('0')
- BigDecimal creditTotal = new BigDecimal('0')
-
- for (GenericValue acctgTransEntry : acctgTransEntryList) {
- if (acctgTransEntry.debitCreditFlag == 'C') {
- creditTotal = creditTotal.add(acctgTransEntry.origAmount)
- } else if (acctgTransEntry.debitCreditFlag == 'D') {
- debitTotal = debitTotal.add(acctgTransEntry.origAmount)
- }
- }
-
- assert debitTotal == creditTotal
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoInvoiceTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoInvoiceTests.groovy
deleted file mode 100644
index 1920ae503e..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoInvoiceTests.groovy
+++ /dev/null
@@ -1,305 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.accounting.invoice.InvoiceWorker
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.entity.util.EntityQuery
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-class AutoInvoiceTests extends OFBizTestCase {
-
- AutoInvoiceTests(String name) {
- super(name)
- }
-
- void testInvoiceWorkerGetInvoiceTotal() {
- String invoiceId = 'demo10000'
- BigDecimal amount = 323.54
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = 'demo10001'
- amount = 36.43
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = 'demo10002'
- amount = 56.99
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = 'demo11000'
- amount = 20.00
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = 'demo11001'
- amount = 543.23
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = 'demo1200'
- amount = 511.23
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = '8000'
- amount = 60.00
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = '8001'
- amount = 10.00
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = '8002'
- amount = 36.43
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = '8003'
- amount = 46.43
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = '8004'
- amount = 33.99
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = '8100'
- amount = 1320.00
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = '8005'
- amount = 33.99
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = '8006'
- amount = 46.43
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = '8007'
- amount = 36.43
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = '8008'
- amount = 48.00
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = '8009'
- amount = 127.09
- assertInvoiceTotal(invoiceId, amount)
-
- invoiceId = '8010'
- amount = 179.97
- assertInvoiceTotal(invoiceId, amount)
- }
-
- // Test case for Commission Run
- void testCommissionRun() {
- /*
- Precondition : For Creating Commission invoice following data should be there :
- 1 ) Sales invoices with paid status.(invoiceId = "8100")
- 2 ) Sales Representative with agreement to Company on product (DemoCustAgent and DemoRepAll). -->
- Postcondition :
- 1 ) Two commission will be creating for the parties DemoCustAgent and DemoRepAll (like 10000 and 10001 invoiceId).
- 2 ) Its amountTotal will be same as commission cost of associated products.
- */
- BigDecimal invoiceTotal = 0
- BigDecimal amountTotal = 0
-
- List<GenericValue> invoiceItems = from('InvoiceItem')
- .where('invoiceId', '8100')
- .queryList()
- assert invoiceItems
-
- for (GenericValue invoiceItem : invoiceItems) {
- if (invoiceItem.productId && invoiceItem.productId == 'WG-9943-B3') {
- invoiceTotal = invoiceTotal.add(invoiceItem.quantity * (invoiceItem.amount * 0.03 + 1))
- }
- }
-
- Map serviceCtx = [
- invoiceIds: ['8100'],
- partyIds: ['DemoRepAll', 'DemoCustAgent', 'DemoRepStore'],
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createCommissionInvoices', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert serviceResult.invoicesCreated
-
- for (Map invoice : serviceResult.invoicesCreated) {
- amountTotal = amountTotal.add(InvoiceWorker.getInvoiceTotal(delegator, invoice.commissionInvoiceId))
- }
- assert invoiceTotal == amountTotal
- }
-
- // Test case to verify GL postings for Cancel Invoice process
- void testGlPostingOnCancelInvoice() {
- /*
- Precondition :
- * Invoice is in ready status so accounting transaction is already posted to the GL
- * GL Accounts associated with Invoice :8008 are ACCOUNTS PAYABLE and UNINVOICED ITEM RECEIPTS
- * Credit in account 210000 - ACCOUNTS PAYABLE ;debitTotal $303.41 ; creditTotal:$1651.7 ; debitCreditDifference : $ -1348.42
- * Debit in account 214000 - UNINVOICED ITEM RECEIPTS;debitTotal :$408 ; creditTotal:$48 ; debitCreditDifference : $360
-
- Post condition : After Cancel Invoice process reverse accounting transactions are automatically posted to the GL.
- * ACCOUNTS PAYABLE 210000 - debitTotal $351.41 ; creditTotal:$1651.7 ; debitCreditDifference : $ -1300
- * UNINVOICED ITEM RECEIPTS 214000 - debitTotal :$408 ; creditTotal:$96 ; debitCreditDifference : $312
- */
- Map serviceCtx = [
- organizationPartyId: 'Company',
- findDate: UtilDateTime.nowTimestamp(),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('findCustomTimePeriods', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert serviceResult.customTimePeriodList
- GenericValue customTimePeriod = (serviceResult.customTimePeriodList).get(0)
-
- serviceCtx.clear()
- serviceResult.clear()
- serviceCtx = [
- organizationPartyId: 'Company',
- customTimePeriodStartDate: customTimePeriod.fromDate,
- customTimePeriodEndDate: customTimePeriod.thruDate,
- glAccountId: '210000',
- userLogin: userLogin
- ]
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- BigDecimal payableDebitTotal = serviceResult.debitTotal
- BigDecimal payableDebitCreditDifference = serviceResult.debitCreditDifference
-
- serviceResult.clear()
- serviceCtx.glAccountId = '214000'
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- BigDecimal uninvoicedCreditTotal = serviceResult.creditTotal
- BigDecimal uninvoicedDebitCreditDifference = serviceResult.debitCreditDifference
-
- serviceResult.clear()
- Map cancelInvoiceCtx = [
- invoiceId: '8008',
- userLogin: userLogin
- ]
- serviceResult = dispatcher.runSync('cancelInvoice', cancelInvoiceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- BigDecimal totalPayableDebitAmount = payableDebitTotal.add(48)
- BigDecimal totalPayableDebitCreditDifference = payableDebitCreditDifference.add(48)
- serviceResult.clear()
- serviceCtx.glAccountId = '210000'
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert totalPayableDebitAmount == serviceResult.debitTotal
- assert totalPayableDebitCreditDifference == serviceResult.debitCreditDifference
-
- BigDecimal totalUnInvoicedCreditAmount = uninvoicedCreditTotal.add(48)
- BigDecimal totalUnInvoicedDebitCreditDifference = uninvoicedDebitCreditDifference.subtract(48)
- serviceResult.clear()
- serviceCtx.glAccountId = '214000'
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert totalUnInvoicedCreditAmount == serviceResult.creditTotal
- assert totalUnInvoicedDebitCreditDifference == serviceResult.debitCreditDifference
- }
-
- // Test case to verify GL postings for Cancel Check Run process
- void testGlPostingOnCancelCheckRun() {
- /*
- Precondition :
- * Two invoices are associated with PaymentGroupId 9000 which are 8001 and 8002
- * Invoices are in ready status so accounting transactions are already posted to the GL
- * GL Accounts associated with Invoices are ACCOUNTS PAYABLE (210000) and GENERAL CHECKING ACCOUNT (111100)
-
- Post condition : After Cancel Check Run process accounting transactions are automatically posted to the GL.
- * ACCOUNTS PAYABLE 210000 - debitTotal increased of $82.86 ; creditTotal increased of $165.72
- ; debitCreditDifference decreased of $82.86
- * GENERAL CHECKING ACCOUNT 111100 - debitTotal increased of $82.86 ; debitCreditDifference increased of $82.86
- */
- Map serviceCtx = [
- organizationPartyId: 'Company',
- findDate: UtilDateTime.nowTimestamp(),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('findCustomTimePeriods', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert serviceResult.customTimePeriodList
- GenericValue customTimePeriod = (serviceResult.customTimePeriodList).get(0)
-
- serviceCtx.clear()
- serviceResult.clear()
- serviceCtx = [
- organizationPartyId: 'Company',
- customTimePeriodStartDate: customTimePeriod.fromDate,
- customTimePeriodEndDate: customTimePeriod.thruDate,
- glAccountId: '210000',
- userLogin: userLogin
- ]
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- BigDecimal payableDebitTotal = serviceResult.debitTotal
- BigDecimal payableCreditTotal = serviceResult.creditTotal
- BigDecimal payableDebitCreditDifference = serviceResult.debitCreditDifference
-
- serviceResult.clear()
- serviceCtx.glAccountId = '111100'
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- BigDecimal undepositedDebitTotal = serviceResult.debitTotal
- BigDecimal undepositedDebitCreditDifference = serviceResult.debitCreditDifference
-
- serviceResult.clear()
- Map cancelCheckRunPaymentsCtx = [
- paymentGroupId: '9000',
- userLogin: userLogin
- ]
- serviceResult = dispatcher.runSync('cancelCheckRunPayments', cancelCheckRunPaymentsCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue paymentGroupMemberAndTrans = from('PmtGrpMembrPaymentAndFinAcctTrans')
- .where('paymentGroupId', '9000')
- .queryFirst()
- if (paymentGroupMemberAndTrans && 'FINACT_TRNS_APPROVED' != paymentGroupMemberAndTrans.finAccountTransStatusId) {
- BigDecimal tempBig = 82.86
-
- BigDecimal totalPayableDebitAmount = tempBig.add(payableDebitTotal)
- BigDecimal totalPayableCreditAmount = 165.72G.add(payableCreditTotal)
- BigDecimal totalPayableDebitCreditDifference = payableDebitCreditDifference.subtract(tempBig)
- serviceResult.clear()
- serviceCtx.glAccountId = '210000'
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert totalPayableDebitAmount == serviceResult.debitTotal
- assert totalPayableCreditAmount == serviceResult.creditTotal
- assert totalPayableDebitCreditDifference == serviceResult.debitCreditDifference
-
- BigDecimal totalUndepositedDebitAmount = tempBig.add(undepositedDebitTotal)
- BigDecimal totalUndepositedDebitCreditDifference = tempBig.add(undepositedDebitCreditDifference)
- serviceResult.clear()
- serviceCtx.glAccountId = '111100'
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert totalUndepositedDebitAmount == serviceResult.debitTotal
- assert totalUndepositedDebitCreditDifference == serviceResult.debitCreditDifference
- }
- }
-
- private void assertInvoiceTotal(String invoiceId, BigDecimal amount) {
- GenericValue invoice = EntityQuery.use(delegator).from('Invoice').where('invoiceId', invoiceId).queryOne()
- BigDecimal invoiceTotal = InvoiceWorker.getInvoiceTotal(invoice)
- assert invoiceTotal == amount
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoPaymentTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoPaymentTests.groovy
deleted file mode 100644
index 87a774fbab..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoPaymentTests.groovy
+++ /dev/null
@@ -1,480 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.apache.ofbiz.accounting
-
-import static org.apache.ofbiz.entity.condition.EntityComparisonOperator.IN
-import static org.apache.ofbiz.entity.condition.EntityCondition.makeCondition
-
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.entity.util.EntityUtil
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-
-class AutoPaymentTests extends OFBizTestCase {
-
- AutoPaymentTests(String name) {
- super(name)
- }
-
- // Test case for Batching Payments process
- void testCreatePaymentGroupAndMember() {
- String paymentGroupTypeId = 'BATCH_PAYMENT'
- String paymentGroupName = 'Payment Batch'
- List paymentIds = ['demo10000', 'demo10001']
-
- Map serviceCtx = [
- paymentGroupTypeId: paymentGroupTypeId,
- paymentGroupName: paymentGroupName,
- paymentIds: paymentIds,
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createPaymentGroupAndMember', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- String paymentGroupId = serviceResult.paymentGroupId
-
- GenericValue paymentGroup = from('PaymentGroup')
- .where('paymentGroupId', paymentGroupId)
- .queryOne()
- assert paymentGroup
- assert paymentGroup.paymentGroupTypeId == paymentGroupTypeId
- assert paymentGroup.paymentGroupName == paymentGroupName
-
- List<GenericValue> paymentGroupMemberList = from('PaymentGroupMember')
- .where('paymentGroupId', paymentGroupId)
- .queryList()
- assert paymentGroupMemberList
-
- for (GenericValue paymentGroupMember : paymentGroupMemberList) {
- assert paymentIds.contains(paymentGroupMember.paymentId)
- }
- }
-
- // Test case for voiding payments
- void testVoidPayment() {
- /*
- Precondition : payment is in sent status and invoice is in ready for posting status
- Credit in account 213000 - CUSTOMER CREDIT
- Debit in account 210000 - ACCOUNTS PAYABLE
-
- Post condition : payment status changes to void.
- removes PaymentApplication if any associated.
- Credit in account 210000- ACCOUNTS PAYABLE
- Debit in account 213000 - CUSTOMER CREDIT
- */
- String paymentId = '8000'
-
- Map serviceCtx = [
- paymentId: paymentId,
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('voidPayment', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue payment = from('Payment')
- .where('paymentId', paymentId)
- .queryOne()
- assert payment
- assert payment.statusId == 'PMNT_VOID'
-
- GenericValue acctgTrans = from('AcctgTrans')
- .where('paymentId', paymentId)
- .orderBy('-transactionDate').queryFirst()
- assert acctgTrans
-
- List<GenericValue> acctgTransEntryList = from('AcctgTransEntry')
- .where('acctgTransId', acctgTrans.acctgTransId)
- .queryList()
- assert acctgTransEntryList
-
- for (GenericValue acctgTransEntry : acctgTransEntryList) {
- if (acctgTransEntry.debitCreditFlag == 'C') {
- assert acctgTransEntry.glAccountTypeId == 'ACCOUNTS_PAYABLE'
- assert acctgTransEntry.glAccountId == '210000'
- } else if (acctgTransEntry.debitCreditFlag == 'D') {
- assert acctgTransEntry.glAccountId == '213000'
- }
- }
- }
-
- // Test case for canceling invoices
- void testCancelInvoice() {
- /*
- Precondition : invoice is in ready status
- Credit in account 210000 - ACCOUNTS PAYABLE
- Debit in account 516100 -->
-
- Post condition : invoice status changes to cancelled.
- removes PaymentApplication if any associated.
- Credit in account 516100
- Debit in account 210000 - ACCOUNTS PAYABLE
- */
- String invoiceId = '8001'
-
- Map serviceCtx = [
- invoiceId: invoiceId,
- statusId: 'INVOICE_CANCELLED',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('setInvoiceStatus', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue invoice = from('Invoice')
- .where('invoiceId', invoiceId)
- .queryOne()
- assert invoice
- assert invoice.statusId == 'INVOICE_CANCELLED'
-
- GenericValue acctgTrans = from('AcctgTrans')
- .where('invoiceId', invoiceId)
- .orderBy('-transactionDate').queryFirst()
- assert acctgTrans
-
- List<GenericValue> acctgTransEntryList = from('AcctgTransEntry')
- .where('acctgTransId', acctgTrans.acctgTransId)
- .queryList()
- assert acctgTransEntryList
-
- for (GenericValue acctgTransEntry : acctgTransEntryList) {
- if (acctgTransEntry.debitCreditFlag == 'C') {
- assert acctgTransEntry.glAccountId == '516100'
- } else if (acctgTransEntry.debitCreditFlag == 'D') {
- assert acctgTransEntry.glAccountId == '210000'
- assert acctgTransEntry.glAccountTypeId == 'ACCOUNTS_PAYABLE'
- }
- }
- }
-
- // Test case for process mass check run
- void testCreatePaymentAndPaymentGroupForInvoices() {
- /*
- Precondition : Invoice is in ready status.
- Invoice outstanding amount should be greater than zero -->
-
- Following process is tested by test case:
- This will call createPaymentAndPaymentGroupForInvoices service and return a paymentGroupId;
- 1. Checked for paymentGroupId for not empty
- 2. Checked for associated paymentGroupMembers for not empty -->
-
- Post condition : Invoice status should be changed to paid.
- Payment should be created with PaymentApplications.
- PaymentGroup and PaymentGroupMembers should be created.
- */
- Map serviceCtx = [
- organizationPartyId: 'Company',
- checkStartNumber: 100101L,
- invoiceIds: ['8000', '8008'],
- paymentMethodTypeId: 'COMPANY_CHECK',
- paymentMethodId: 'SC_CHECKING',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createPaymentAndPaymentGroupForInvoices', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- String paymentGroupId = serviceResult.paymentGroupId
- assert paymentGroupId
-
- List<GenericValue> paymentGroupMemberList = from('PaymentGroupMember')
- .where('paymentGroupId', paymentGroupId)
- .queryList()
- assert paymentGroupMemberList
- }
-
- // Test case for cancel check run
- void testCancelCheckRunPayments() {
- /*
- Pre condition : Invoice is in paid status.
- Payment should be present.
- thruDate for PaymentGroupMember should be Null -->
-
- Following process is tested by test case:
- This will call cancelCheckRunPayments service;
- 1. Checked for thruDate for not empty
- 2. Checked for associated payment status as PMNT_VOID -->
-
- Post condition : thruDate for PaymentGroupMember should be Not Null
- payment status should be changed to PMNT_VOID.
- */
- String paymentGroupId = '9001'
-
- Map serviceCtx = [
- paymentGroupId: paymentGroupId,
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('cancelCheckRunPayments', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- List<GenericValue> paymentGroupMemberAndTransList = from('PmtGrpMembrPaymentAndFinAcctTrans')
- .where('paymentGroupId', paymentGroupId)
- .queryList()
- GenericValue firstPaymentGroupMemberAndTrans = EntityUtil.getFirst(paymentGroupMemberAndTransList)
- if (firstPaymentGroupMemberAndTrans && 'FINACT_TRNS_APPROVED' != firstPaymentGroupMemberAndTrans.finAccountTransStatusId) {
- for (GenericValue aymentGroupMemberAndTrans : paymentGroupMemberAndTransList) {
- assert aymentGroupMemberAndTrans.thruDate
- assert aymentGroupMemberAndTrans.statusId == 'PMNT_VOID'
- }
- }
- }
-
- // Test case for deposit or withdraw payments
- void testDepositWithdrawPayments() {
- //List paymentIds = ['demo10001', 'demo10010']
- List paymentIds = ['demo10010']
-
- Map serviceCtx = [
- paymentIds: paymentIds,
- finAccountId: 'SC_CHECKING',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('depositWithdrawPayments', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- String
-
- List<GenericValue> payments = from('Payment')
- .where(makeCondition('paymentId', IN, paymentIds))
- .queryList()
-
- for (GenericValue payment : payments) {
- GenericValue finAccountTrans = from('FinAccountTrans')
- .where('finAccountTransId', payment.finAccountTransId)
- .queryOne()
- assert finAccountTrans
- assert ['DEPOSIT', 'WITHDRAWAL'].contains(finAccountTrans.finAccountTransTypeId)
- assert finAccountTrans.amount == payment.amount
- }
- }
-
- void testDepositWithdrawPaymentsInSingleTrans() {
- List paymentIds = ['8004']
- BigDecimal paymentRunningTotal = new BigDecimal('0')
-
- Map serviceCtx = [
- paymentIds: paymentIds,
- finAccountId: 'SC_CHECKING',
- groupInOneTransaction: 'Y',
- paymentGroupTypeId: 'BATCH_PAYMENT',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('depositWithdrawPayments', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- String finAccountTransId = serviceResult.finAccountTransId
-
- List<GenericValue> payments = from('Payment')
- .where(makeCondition('paymentId', IN, paymentIds))
- .queryList()
- for (GenericValue payment : payments) {
- assert finAccountTransId == payment.finAccountTransId
- paymentRunningTotal = paymentRunningTotal.add(payment.amount)
- }
-
- GenericValue finAccountTrans = from('FinAccountTrans')
- .where('finAccountTransId', finAccountTransId)
- .queryOne()
- assert paymentRunningTotal == finAccountTrans.amount
- }
-
- // Test case for fin account trans
- void testSetFinAccountTransStatus() {
- /*
- Precondition : FinAccountTrans should be in CREATED status
-
- Post condition : FinAccountTrans status changes to CANCELED
- Clear finAccountTransId field and update associated Payment record
- */
- String finAccountTransId = '9102'
-
- Map serviceCtx = [
- finAccountTransId: finAccountTransId,
- statusId: 'FINACT_TRNS_CANCELED',
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('setFinAccountTransStatus', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue finAccountTrans = from('FinAccountTrans')
- .where('finAccountTransId', finAccountTransId)
- .queryOne()
- assert finAccountTrans
- assert finAccountTrans.statusId == 'FINACT_TRNS_CANCELED'
-
- GenericValue payment = from('Payment')
- .where('paymentId', finAccountTrans.paymentId)
- .queryOne()
- assert payment
- }
-
- // Test case to verify GL postings for Void Payment process
- void testGlPostingsOnVoidPayment() {
- /*
- Precondition :
- * Payment is in sent status so accounting transaction is already posted to the GL
- * GL Account associated with Payment :8003 are ACCOUNTS RECEVABLE and UNDEPOSITED RECEIPTS
- * Credit in account 120000 - ACCOUNTS RECEVABLE ;debitTotal :$754.17 ; creditTotal:$274.18 ; debitCreditDifference : $479.99
- * Debit in account 112000 UNDEPOSITED RECEIPTS ;debitTotal :$136.85 ; creditTotal:$116.85 ; debitCreditDifference : $20
-
- Post condition : When status is set to void, an reverse accounting transaction is automatically posted to the GL.
- * Payment status changes to void.
- * Credit in account 112000- UNDEPOSITED RECEIPTS ;debitTotal :$136.85 ; creditTotal: $136.85 ; debitCreditDifference : $0
- * Debit in account 120000 - ACCOUNTS RECEVABLE debitTotal :$774.17 ; creditTotal: $274.18 ; debitCreditDifference : $ 499.99
- */
- Map serviceCtx = [
- organizationPartyId: 'Company',
- findDate: UtilDateTime.nowTimestamp(),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('findCustomTimePeriods', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert serviceResult.customTimePeriodList
- GenericValue customTimePeriod = (serviceResult.customTimePeriodList).get(0)
-
- serviceCtx.clear()
- serviceResult.clear()
- serviceCtx = [
- organizationPartyId: 'Company',
- customTimePeriodStartDate: customTimePeriod.fromDate,
- customTimePeriodEndDate: customTimePeriod.thruDate,
- glAccountId: '120000',
- userLogin: userLogin
- ]
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- BigDecimal receivableDebitTotal = serviceResult.debitTotal
- BigDecimal receivableDebitCreditDifference = serviceResult.debitCreditDifference
-
- serviceResult.clear()
- serviceCtx.glAccountId = '112000'
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- BigDecimal undepositedCreditTotal = serviceResult.creditTotal
- BigDecimal undepositedDebitCreditDifference = serviceResult.debitCreditDifference
-
- serviceResult.clear()
- Map voidPaymentCtx = [
- paymentId: '8003',
- userLogin: userLogin
- ]
- serviceResult = dispatcher.runSync('voidPayment', voidPaymentCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- BigDecimal totalReceivableDebitAmount = receivableDebitTotal.add(new BigDecimal('20'))
- BigDecimal totalReceivableDebitCreditDifference = receivableDebitCreditDifference.add(new BigDecimal('20'))
- serviceResult.clear()
- serviceCtx.glAccountId = '120000'
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert serviceResult
- assert totalReceivableDebitAmount == serviceResult.debitTotal
- assert totalReceivableDebitCreditDifference == serviceResult.debitCreditDifference
-
- BigDecimal totalUndepositedCreditAmount = undepositedCreditTotal.add(new BigDecimal('20'))
- BigDecimal totalUndepositedDebitCreditDifference = undepositedDebitCreditDifference.subtract(new BigDecimal('20'))
- serviceResult.clear()
- serviceCtx.glAccountId = '112000'
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert serviceResult
- assert totalUndepositedCreditAmount == serviceResult.creditTotal
- assert totalUndepositedDebitCreditDifference == serviceResult.debitCreditDifference
- }
-
- // Test case to verify GL postings for Check Run process
- void testGlPostingOnCheckRun() {
- /*
- Precondition :
- * Invoice is in ready status so accounting transaction is already posted to the GL
- * GL Accounts associated with Invoice :8007 are ACCOUNTS PAYABLE and UNINVOICED ITEM RECEIPTS
- * Credit in account 210000 - ACCOUNTS PAYABLE ;debitTotal $430 ; creditTotal:$1955.4 ; debitCreditDifference : $ -1524.85
- * Debit in account 214000 - UNINVOICED ITEM RECEIPTS;debitTotal :$408 ; creditTotal:$48 ; debitCreditDifference : $360
- * UNDEPOSITED RECEIPTS 112000 - debitTotal :$136.85 ; creditTotal:$136.85 ; debitCreditDifference : $0
-
- Post condition : After Check Run process accounting transactions are automatically posted to the GL.
- * Payment get associated with invoice.
- * GL Accounts associated with Payment are ACCOUNTS PAYABLE and UNDEPOSITED RECEIPTS.
- * ACCOUNTS PAYABLE 210000(for Invoice and Payment) - debitTotal $503.41 ; creditTotal:$1991.83 ; debitCreditDifference : $ -1488.42
- * UNINVOICED ITEM RECEIPTS 214000 - debitTotal :$408 ; creditTotal:$48 ; debitCreditDifference : $360
- * GENERAL CHECKING ACCOUNT 111100 (for payment)- debitTotal :$136.85 ; creditTotal:$173.28 ; debitCreditDifference : $ -36.43
- */
- Map serviceCtx = [
- organizationPartyId: 'Company',
- findDate: UtilDateTime.nowTimestamp(),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('findCustomTimePeriods', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert serviceResult.customTimePeriodList
- GenericValue customTimePeriod = (serviceResult.customTimePeriodList).get(0)
-
- serviceCtx.clear()
- serviceResult.clear()
- serviceCtx = [
- organizationPartyId: 'Company',
- customTimePeriodStartDate: customTimePeriod.fromDate,
- customTimePeriodEndDate: customTimePeriod.thruDate,
- glAccountId: '210000',
- userLogin: userLogin
- ]
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- BigDecimal payableDebitTotal = serviceResult.debitTotal
- BigDecimal payableCreditTotal = serviceResult.creditTotal
- BigDecimal payableDebitCreditDifference = serviceResult.debitCreditDifference
-
- serviceResult.clear()
- serviceCtx.glAccountId = '111100'
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- BigDecimal undepositedDebitTotal = serviceResult.debitTotal
- BigDecimal undepositedCreditTotal = serviceResult.creditTotal
- BigDecimal undepositedDebitCreditDifference = serviceResult.debitCreditDifference
-
- serviceResult.clear()
- Map invoiceServiceCtx = [
- organizationPartyId: 'Company',
- checkStartNumber: 100100L,
- invoiceIds: ['8007'],
- paymentMethodTypeId: 'COMPANY_CHECK',
- paymentMethodId: 'SC_CHECKING',
- userLogin: userLogin
- ]
- serviceResult = dispatcher.runSync('createPaymentAndPaymentGroupForInvoices', invoiceServiceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- String paymentGroupId = serviceResult.paymentGroupId
- assert paymentGroupId
-
- BigDecimal tempBig = 36.43
-
- BigDecimal totalPayableDebitAmount = tempBig.add(payableDebitTotal)
- BigDecimal totalPayableDebitCreditDifference = tempBig.add(payableDebitCreditDifference)
- serviceResult.clear()
- serviceCtx.glAccountId = '210000'
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert totalPayableDebitAmount == serviceResult.debitTotal
- assert payableCreditTotal == serviceResult.creditTotal
- assert totalPayableDebitCreditDifference == serviceResult.debitCreditDifference
-
- BigDecimal totalUndepositedCreditAmount = tempBig.add(undepositedCreditTotal)
- BigDecimal totalUndepositedDebitCreditDifference = undepositedDebitCreditDifference.subtract(tempBig)
- serviceResult.clear()
- serviceCtx.glAccountId = '111100'
- serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
- assert undepositedDebitTotal == serviceResult.debitTotal
- assert totalUndepositedCreditAmount == serviceResult.creditTotal
- assert totalUndepositedDebitCreditDifference == serviceResult.debitCreditDifference
- }
-
-}
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/FixedAssetTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/FixedAssetTests.groovy
deleted file mode 100644
index b4f87209f1..0000000000
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/FixedAssetTests.groovy
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ofbiz.accounting
-
-import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
-import org.apache.ofbiz.service.testtools.OFBizTestCase
-import java.sql.Timestamp
-
-class FixedAssetTests extends OFBizTestCase {
-
- FixedAssetTests(String name) {
- super(name)
- }
- void testCreateFixedAssetRegistration() {
- Map serviceCtx = [
- fixedAssetId: 'DEMO_VEHICLE_01',
- licenseNumber: '123456',
- registrationNumber: 'abcdef',
- registrationDate: UtilDateTime.toTimestamp('01/01/2020 00:00:00'),
- fromDate: UtilDateTime.nowTimestamp(),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createFixedAssetRegistration', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue fixedAssetRegistration = from('FixedAssetRegistration')
- .where('fixedAssetId', 'DEMO_VEHICLE_01')
- .filterByDate().queryFirst()
- assert fixedAssetRegistration
- }
- void testUpdateFixedAssetRegistration() {
- Timestamp fromDate = UtilDateTime.toTimestamp('04/01/2020 00:00:00')
- Map serviceCtx = [
- fixedAssetId: 'DEMO_VEHICLE_01',
- licenseNumber: 'updated-123456',
- registrationNumber: 'updated-abcdef',
- registrationDate: UtilDateTime.toTimestamp('01/01/2020 00:00:00'),
- fromDate: fromDate,
- thruDate: UtilDateTime.nowTimestamp(),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('updateFixedAssetRegistration', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue fixedAssetRegistration = from('FixedAssetRegistration')
- .where('fixedAssetId', 'DEMO_VEHICLE_01', 'fromDate', fromDate)
- .filterByDate().queryOne()
- assert fixedAssetRegistration == null
- }
- void testDeleteFixedAssetRegistration() {
- Timestamp fromDate = UtilDateTime.toTimestamp('04/01/2020 00:00:00')
- Map serviceCtx = [
- fixedAssetId: 'DEMO_VEHICLE_01',
- fromDate: fromDate,
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('deleteFixedAssetRegistration', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue fixedAssetRegistration = from('FixedAssetRegistration')
- .where('fixedAssetId', 'DEMO_VEHICLE_01', 'fromDate', fromDate)
- .queryOne()
- assert fixedAssetRegistration == null
- }
- void testCreateFixedAssetMeter() {
- Map serviceCtx = [
- fixedAssetId: 'DEMO_VEHICLE_01',
- productMeterTypeId: 'ODOMETER',
- readingDate: UtilDateTime.nowTimestamp(),
- meterValue: BigDecimal.valueOf(65),
- userLogin: userLogin
- ]
- Map serviceResult = dispatcher.runSync('createFixedAssetMeter', serviceCtx)
- assert ServiceUtil.isSuccess(serviceResult)
-
- GenericValue fixedAssetMeter = from('FixedAssetMeter')
- .where('fixedAssetId', 'DEMO_VEHICLE_01', 'productMeterTypeId', 'ODOMETER')
- .queryFirst()
- assert fixedAssetMeter
- }
- void testUpdateFixedAssetMeter() {
- Timestamp readingDate = UtilDateTime.toTimestamp('04/01/2020 00:00:00')
- Map serviceCtx = [
- fixedAssetId: 'DEMO_VEHICLE_01',
- productMeterTypeId: 'ODOMETER',
- readingDate: readingDate,
- meterValue: BigDecimal.valueOf(85),
- userLogin: userLogin
- ]
... 115224 lines suppressed ...