| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| 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-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd"> |
| |
| <simple-method method-name="createInvoiceItemPayrol" short-description="Create a new Invoice Item with Payrol Item Type"> |
| <entity-condition entity-name="InvoiceItemType" list="PayrolGroup"> |
| <condition-expr field-name="parentTypeId" value="PAYROL"/> |
| </entity-condition> |
| <entity-condition entity-name="InvoiceItemType" list="PayrolList"/> |
| <iterate entry="payrolGroup" list="PayrolGroup"> |
| <iterate entry="payrolList" list="PayrolList"> |
| <if-compare field="payrolList.parentTypeId" value="${payrolGroup.invoiceItemTypeId}" operator="equals"> |
| <set field="AddInvoiceItem" value="N"/> |
| <set field="createInvoiceItem.invoiceId" from-field="parameters.invoiceId"/> |
| <set field="createInvoiceItem.invoiceItemTypeId" from-field="payrolList.invoiceItemTypeId"/> |
| <set field="createInvoiceItem.description" value="${payrolGroup.description} : ${payrolList.description}"/> |
| <set field="createInvoiceItem.quantity" from-field="parameters.${payrolList.invoiceItemTypeId}_Quantity"/> |
| <if-not-empty field="parameters.${payrolList.invoiceItemTypeId}_Quantity"> |
| <set field="AddInvoiceItem" value="Y"/> |
| </if-not-empty> |
| <set field="createInvoiceItem.amount" from-field="parameters.${payrolList.invoiceItemTypeId}_Amount"/> |
| <if-not-empty field="parameters.${payrolList.invoiceItemTypeId}_Amount"> |
| <set field="AddInvoiceItem" value="Y"/> |
| </if-not-empty> |
| <if-compare field="AddInvoiceItem" value="Y" operator="equals"> |
| <!-- negate amount if required --> |
| <if-compare field="payrolGroup.invoiceItemTypeId" value="PAYROL_EARN_HOURS" operator="not-equals"> |
| <calculate field="createInvoiceItem.amount"> |
| <calcop operator="multiply" field="createInvoiceItem.amount"> |
| <number value="-1"/> |
| </calcop> |
| </calculate> |
| </if-compare> |
| <call-service service-name="createInvoiceItem" in-map-name="createInvoiceItem"/> |
| </if-compare> |
| </if-compare> |
| </iterate> |
| </iterate> |
| </simple-method> |
| |
| </simple-methods> |