Author: jacopoc
Date: Mon Dec 17 08:40:35 2007 New Revision: 604922 URL: http://svn.apache.org/viewvc?rev=604922&view=rev Log: First step in the implementation of past due date invoices: created a service that computes the due date(s) and outstanding amount(s) based on the Invoice terms; added initial support for multiple payment terms per invoice (e.g. 'pay after 30 days the 50% of the invoice, pay after 60 days the 40%, pay after 90 the 10%'). Part of issue OFBIZ-1530 Modified the getDayEnd util method to be usable in Minilang. Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml ofbiz/trunk/applications/accounting/servicedef/services_payment.xml ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java ofbiz/trunk/applications/party/data/PartyTypeData.xml ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml?rev=604922&r1=604921&r2=604922&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml (original) +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml Mon Dec 17 08:40:35 2007 @@ -242,4 +242,106 @@ <field-to-result field-name="paymentId" result-name="paymentId"/> <field-to-result field-name="paymentApplicationId" result-name="paymentApplicationId"/> </simple-method> + + <simple-method method-name="getInvoicePaymentInfoList" short-description="Create a list with information on payment due dates and amounts for the invoice"> + <entity-one entity-name="Invoice" value-name="invoice"/> + <call-class-method class-name="org.ofbiz.accounting.invoice.InvoiceWorker" method-name="getInvoiceTotalBd" ret-field-name="invoiceTotalAmount"> + <field field-name="invoice" type="org.ofbiz.entity.GenericValue"/> + </call-class-method> + <call-class-method class-name="org.ofbiz.accounting.invoice.InvoiceWorker" method-name="getInvoiceAppliedBd" ret-field-name="invoiceTotalAmountPaid"> + <field field-name="invoice" type="org.ofbiz.entity.GenericValue"/> + </call-class-method> + <get-related relation-name="InvoiceTerm" value-name="invoice" list-name="invoiceTerms"/> + <set field="remainingAppliedAmount" from-field="invoiceTotalAmountPaid" type="BigDecimal"/> + <set field="computedTotalAmount" value="0.0" type="BigDecimal"/> + <iterate list-name="invoiceTerms" entry-name="invoiceTerm"> + <get-related-one relation-name="TermType" value-name="invoiceTerm" to-value-name="termType" use-cache="true"/> + <if-compare field-name="termType.parentTypeId" operator="equals" value="FIN_PAYMENT_TERM"> + <clear-field field-name="invoicePaymentInfo"/> + <set field="invoicePaymentInfo.invoiceId" from-field="invoice.invoiceId"/> + <set field="invoicePaymentInfo.invoiceTermId" from-field="invoiceTerm.invoiceTermId"/> + <set field="invoicePaymentInfo.termTypeId" from-field="invoiceTerm.termTypeId"/> + <call-class-method class-name="org.ofbiz.base.util.UtilDateTime" method-name="getDayEnd" ret-field-name="invoicePaymentInfo.dueDate"> + <field field-name="invoice.invoiceDate" type="Timestamp"/> + <field field-name="invoiceTerm.termDays" type="Long"/> + </call-class-method> + <calculate field-name="invoiceTermAmount" type="BigDecimal"> + <calcop field-name="invoiceTotalAmount" operator="multiply"> + <calcop field-name="invoiceTerm.termValue" operator="get"/> + </calcop> + </calculate> + <calculate field-name="invoiceTermAmount" type="BigDecimal"> + <calcop field-name="invoiceTermAmount" operator="divide"> + <number value="100"/> + </calcop> + </calculate> + <set field="invoicePaymentInfo.amount" from-field="invoiceTermAmount"/> + <calculate field-name="computedTotalAmount" type="BigDecimal"> + <calcop field-name="computedTotalAmount" operator="add"> + <calcop field-name="invoicePaymentInfo.amount" operator="get"/> + </calcop> + </calculate> + <if-compare-field field-name="remainingAppliedAmount" operator="greater-equals" to-field-name="invoiceTermAmount" type="BigDecimal"> + <set field="invoicePaymentInfo.paidAmount" from-field="invoiceTermAmount" type="BigDecimal"/> + <calculate field-name="remainingAppliedAmount" type="BigDecimal"> + <calcop field-name="remainingAppliedAmount" operator="subtract"> + <calcop field-name="invoiceTermAmount" operator="get"/> + </calcop> + </calculate> + <else> + <set field="invoicePaymentInfo.paidAmount" from-field="remainingAppliedAmount" type="BigDecimal"/> + <set field="" from-field="remainingAppliedAmount" type="BigDecimal"/> + <set field="remainingAppliedAmount" value="0.0" type="BigDecimal"/> + </else> + </if-compare-field> + <calculate field-name="invoicePaymentInfo.outstandingAmount" type="BigDecimal"> + <calcop field-name="invoicePaymentInfo.amount" operator="subtract"> + <calcop field-name="invoicePaymentInfo.paidAmount" operator="get"/> + </calcop> + </calculate> + <set field="invoicePaymentInfoList[]" from-field="invoicePaymentInfo"/> + </if-compare> + </iterate> + <if> + <condition> + <or> + <if-compare field-name="remainingAppliedAmount" operator="greater" value="0.0" type="BigDecimal"/> + <if-compare-field field-name="computedTotalAmount" operator="less" to-field-name="invoiceTotalAmount" type="BigDecimal"/> + </or> + </condition> + <then> + <clear-field field-name="invoicePaymentInfo"/> + <set field="andMap.termTypeId" value="FIN_PAYMENT_TERM"/> + <filter-list-by-and list-name="invoiceTerms" map-name="andMap"/> + <first-from-list list-name="invoiceTerms" entry-name="invoiceTerm"/> + <if-not-empty field-name="invoiceTerm"> + <set field="invoicePaymentInfo.termTypeId" from-field="invoiceTerm.termTypeId"/> + <call-class-method class-name="org.ofbiz.base.util.UtilDateTime" method-name="getDayEnd" ret-field-name="invoicePaymentInfo.dueDate"> + <field field-name="invoice.invoiceDate" type="Timestamp"/> + <field field-name="invoiceTerm.termDays" type="Long"/> + </call-class-method> + <else> + <call-class-method class-name="org.ofbiz.base.util.UtilDateTime" method-name="getDayEnd" ret-field-name="invoicePaymentInfo.dueDate"> + <field field-name="invoice.invoiceDate" type="Timestamp"/> + </call-class-method> + </else> + </if-not-empty> + <set field="invoicePaymentInfo.invoiceId" from-field="invoice.invoiceId"/> + <calculate field-name="invoicePaymentInfo.amount" type="BigDecimal"> + <calcop field-name="invoiceTotalAmount" operator="subtract"> + <calcop field-name="computedTotalAmount" operator="get"/> + </calcop> + </calculate> + <set field="invoicePaymentInfo.paidAmount" from-field="remainingAppliedAmount" type="BigDecimal"/> + <calculate field-name="invoicePaymentInfo.outstandingAmount" type="BigDecimal"> + <calcop field-name="invoicePaymentInfo.amount" operator="subtract"> + <calcop field-name="invoicePaymentInfo.paidAmount" operator="get"/> + </calcop> + </calculate> + <set field="invoicePaymentInfoList[]" from-field="invoicePaymentInfo"/> + </then> + </if> + <field-to-result field-name="invoicePaymentInfoList" result-name="invoicePaymentInfoList"/> + </simple-method> + </simple-methods> Modified: ofbiz/trunk/applications/accounting/servicedef/services_payment.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_payment.xml?rev=604922&r1=604921&r2=604922&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_payment.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_payment.xml Mon Dec 17 08:40:35 2007 @@ -125,4 +125,11 @@ <override name="statusId" optional="false"/> <override name="amount" optional="false"/> </service> + + <service name="getInvoicePaymentInfoList" engine="simple" + location="org/ofbiz/accounting/payment/PaymentServices.xml" invoke="getInvoicePaymentInfoList" auth="true"> + <description>Create a list with information on payment due dates and amounts for the invoice</description> + <attribute name="invoiceId" type="String" mode="IN" optional="false"/> + <attribute name="invoicePaymentInfoList" type="List" mode="OUT" optional="false"/> + </service> </services> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?rev=604922&r1=604921&r2=604922&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java Mon Dec 17 08:40:35 2007 @@ -221,9 +221,9 @@ Timestamp thruDate; if (finAccountSettings != null && finAccountSettings.getLong("authValidDays") != null) { - thruDate = UtilDateTime.getDayEnd(UtilDateTime.nowTimestamp(), finAccountSettings.getLong("authValidDays").intValue()); + thruDate = UtilDateTime.getDayEnd(UtilDateTime.nowTimestamp(), finAccountSettings.getLong("authValidDays")); } else { - thruDate = UtilDateTime.getDayEnd(UtilDateTime.nowTimestamp(), 30); // default 30 days for an auth + thruDate = UtilDateTime.getDayEnd(UtilDateTime.nowTimestamp(), new Long(30)); // default 30 days for an auth } Map tmpResult = dispatcher.runSync("createFinAccountAuth", UtilMisc.<String, Object>toMap("finAccountId", finAccountId, Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java?rev=604922&r1=604921&r2=604922&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java Mon Dec 17 08:40:35 2007 @@ -201,7 +201,7 @@ } // set the dates/userlogin - inContext.put("thruDate", UtilDateTime.getDayEnd(now, accountValidDays.intValue())); + inContext.put("thruDate", UtilDateTime.getDayEnd(now, accountValidDays)); inContext.put("fromDate", now); inContext.put("userLogin", userLogin); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=604922&r1=604921&r2=604922&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Mon Dec 17 08:40:35 2007 @@ -237,7 +237,7 @@ Long orderTermNetDays = orh.getOrderTermNetDays(); Timestamp dueDate = null; if (orderTermNetDays != null) { - dueDate = UtilDateTime.getDayEnd(invoiceDate, orderTermNetDays.intValue()); + dueDate = UtilDateTime.getDayEnd(invoiceDate, orderTermNetDays); } // create the invoice record @@ -934,7 +934,7 @@ createInvoiceContext.put("invoiceDate", now); // if there were days associated with the commission agreement, then set a dueDate for the invoice. if (days != null) { - createInvoiceContext.put("dueDate", UtilDateTime.getDayEnd(now, days.intValue())); + createInvoiceContext.put("dueDate", UtilDateTime.getDayEnd(now, days)); } createInvoiceContext.put("invoiceTypeId", invoiceType); // start with INVOICE_IN_PROCESS, in the INVOICE_READY we can't change the invoice (or shouldn't be able to...) Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java?rev=604922&r1=604921&r2=604922&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java Mon Dec 17 08:40:35 2007 @@ -478,7 +478,7 @@ if (availableBalance.compareTo(amountBd) > -1) { Timestamp thruDate = null; if (giftCertSettings.getLong("authValidDays") != null) { - thruDate = UtilDateTime.getDayEnd(UtilDateTime.nowTimestamp(), giftCertSettings.getLong("authValidDays").intValue()); + thruDate = UtilDateTime.getDayEnd(UtilDateTime.nowTimestamp(), giftCertSettings.getLong("authValidDays")); } Map tmpResult = dispatcher.runSync("createFinAccountAuth", UtilMisc.<String, Object>toMap("finAccountId", finAccountId, "amount", amount, "currencyUomId", currency, "thruDate", thruDate, "userLogin", userLogin)); Modified: ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml?rev=604922&r1=604921&r2=604922&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml Mon Dec 17 08:40:35 2007 @@ -467,4 +467,20 @@ </field> <field name="submitButton" title="${uiLabelMap.CommonSubmit}"><submit button-type="button"/></field> </form> + + <form name="ListInvoicePaymentInfo" type="list" list-name="invoicePaymentInfoList"> + <actions> + <service service-name="getInvoicePaymentInfoList" result-map-list-name="invoicePaymentInfoList"> + <field-map field-name="invoiceId" env-name="parameters.invoiceId"/> + </service> + </actions> + <field name="invoiceId"><hidden/></field> + <field name="termTypeId"> + <display-entity entity-name="TermType" description="${description}"/> + </field> + <field name="dueDate"><display/></field> + <field name="amount"><display/></field> + <field name="paidAmount"><display/></field> + <field name="outstandingAmount"><display/></field> + </form> </forms> Modified: ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml?rev=604922&r1=604921&r2=604922&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml Mon Dec 17 08:40:35 2007 @@ -158,7 +158,6 @@ <set field="invoiceAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotalBd(invoice)}"/> <set field="notAppliedAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(invoice)}"/> <set field="appliedAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceAppliedBd(invoice)}"/> - </actions> <widgets> <decorator-screen name="CommonInvoiceDecorator" location="${parameters.invoiceDecoratorLocation}"> @@ -178,6 +177,7 @@ <include-form name="ListInvoiceStatus" location="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"/> <container><label style="head1" text="${uiLabelMap.PartyTerms}"/></container> <include-form name="ListInvoiceTerms" location="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"/> + <include-form name="ListInvoicePaymentInfo" location="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"/> <container><label style="head1" text="${uiLabelMap.AccountingAppliedPayments}: ${appliedAmount?currency(${invoice.currencyUomId})}, ${uiLabelMap.AccountingOpenPayments}: ${notAppliedAmount?currency(${invoice.currencyUomId})}"/></container> <container><link target="editInvoiceApplications?invoiceId=${invoiceId}" text="${uiLabelMap.CommonUpdate}" style="buttontext"/></container> <include-form name="ListInvoiceApplications" location="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"/> @@ -198,6 +198,7 @@ <include-form name="ListInvoiceStatus" location="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"/> <container><label style="head1" text="${uiLabelMap.PartyTerms}"/></container> <include-form name="ListInvoiceTerms" location="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"/> + <include-form name="ListInvoicePaymentInfo" location="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"/> <container><label style="head1" text="${uiLabelMap.AccountingAppliedPayments}: ${appliedAmount?currency(${invoice.currencyUomId})}, ${uiLabelMap.AccountingOpenPayments}: ${notAppliedAmount?currency(${invoice.currencyUomId})}"/></container> <include-form name="ListInvoiceApplications" location="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"/> <container><label style="head1" text="${uiLabelMap.AccountingInvoiceItems}"/></container> Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java?rev=604922&r1=604921&r2=604922&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java Mon Dec 17 08:40:35 2007 @@ -456,7 +456,7 @@ Time startTime = (Time) position.get("startTime"); int moveDay = ((Integer) position.get("moveDay")).intValue(); Double capacity = (Double) position.get("capacity"); - dateTo = (moveDay == 0) ? dateFrom : UtilDateTime.getDayEnd(dateFrom,moveDay); + dateTo = (moveDay == 0) ? dateFrom : UtilDateTime.getDayEnd(dateFrom, new Long(moveDay)); Timestamp endAvailablePeriod = new Timestamp(UtilDateTime.getDayStart(dateTo).getTime() + startTime.getTime() + capacity.longValue() + cDateTrav.get(Calendar.ZONE_OFFSET) + cDateTrav.get(Calendar.DST_OFFSET)); if (dateTo.after(endAvailablePeriod) ) { dateTo = endAvailablePeriod; Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=604922&r1=604921&r2=604922&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Mon Dec 17 08:40:35 2007 @@ -821,7 +821,7 @@ // if there is a storeCreditValidDays, set the thruDate to (nowTimestamp + storeCreditValidDays + end of day) Timestamp thruDate = null; - if (storeCreditValidDays != null) thruDate = UtilDateTime.getDayEnd(UtilDateTime.nowTimestamp(), storeCreditValidDays.intValue()); + if (storeCreditValidDays != null) thruDate = UtilDateTime.getDayEnd(UtilDateTime.nowTimestamp(), storeCreditValidDays); // create the billing account Map input = UtilMisc.toMap("accountLimit", new Double(0.00), "description", "Credit Account for Return #" + returnHeader.get("returnId"), "userLogin", userLogin); Modified: ofbiz/trunk/applications/party/data/PartyTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/data/PartyTypeData.xml?rev=604922&r1=604921&r2=604922&view=diff ============================================================================== --- ofbiz/trunk/applications/party/data/PartyTypeData.xml (original) +++ ofbiz/trunk/applications/party/data/PartyTypeData.xml Mon Dec 17 08:40:35 2007 @@ -325,6 +325,9 @@ <TermType description="Financial" hasTable="N" parentTypeId="" termTypeId="FINANCIAL_TERM"/> <TermType description="Payment (net days)" hasTable="N" parentTypeId="FINANCIAL_TERM" termTypeId="FIN_PAYMENT_TERM"/> + <TermType description="Payment net days, part 1" hasTable="N" parentTypeId="FIN_PAYMENT_TERM" termTypeId="FIN_PAY_NETDAYS_1"/> + <TermType description="Payment net days, part 2" hasTable="N" parentTypeId="FIN_PAYMENT_TERM" termTypeId="FIN_PAY_NETDAYS_2"/> + <TermType description="Payment net days, part 3" hasTable="N" parentTypeId="FIN_PAYMENT_TERM" termTypeId="FIN_PAY_NETDAYS_3"/> <TermType description="Payment (discounted if paid within specified days)" hasTable="N" parentTypeId="FINANCIAL_TERM" termTypeId="FIN_PAYMENT_DISC"/> <TermType description="Payment (due on specified day of month)" hasTable="N" parentTypeId="FINANCIAL_TERM" termTypeId="FIN_PAYMENT_FIXDAY"/> <TermType description="Late Fee (percent)" hasTable="N" parentTypeId="FINANCIAL_TERM" termTypeId="FIN_LATE_FEE_TERM"/> Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java?rev=604922&r1=604921&r2=604922&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java (original) +++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java Mon Dec 17 08:40:35 2007 @@ -227,10 +227,10 @@ } public static java.sql.Timestamp getDayEnd(java.sql.Timestamp stamp) { - return getDayEnd(stamp, 0); + return getDayEnd(stamp, new Long(0)); } - public static java.sql.Timestamp getDayEnd(java.sql.Timestamp stamp, int daysLater) { + public static java.sql.Timestamp getDayEnd(java.sql.Timestamp stamp, Long daysLater) { return getDayEnd(stamp, daysLater, getDefaultTimeZone(), Locale.getDefault()); } @@ -804,13 +804,13 @@ } public static Timestamp getDayEnd(Timestamp stamp, TimeZone timeZone, Locale locale) { - return getDayEnd(stamp, 0, timeZone, locale); + return getDayEnd(stamp, new Long(0), timeZone, locale); } - public static Timestamp getDayEnd(Timestamp stamp, int daysLater, TimeZone timeZone, Locale locale) { + public static Timestamp getDayEnd(Timestamp stamp, Long daysLater, TimeZone timeZone, Locale locale) { Calendar tempCal = toCalendar(stamp, timeZone, locale); tempCal.set(tempCal.get(Calendar.YEAR), tempCal.get(Calendar.MONTH), tempCal.get(Calendar.DAY_OF_MONTH), 23, 59, 59); - tempCal.add(Calendar.DAY_OF_MONTH, daysLater); + tempCal.add(Calendar.DAY_OF_MONTH, daysLater.intValue()); Timestamp retStamp = new Timestamp(tempCal.getTimeInMillis()); retStamp.setNanos(999999999); return retStamp; |
Free forum by Nabble | Edit this page |