Author: apatel
Date: Thu Nov 12 22:55:35 2009 New Revision: 835622 URL: http://svn.apache.org/viewvc?rev=835622&view=rev Log: Screenlets for Quick view into invoices past due and invoices coming due soon. Added: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml ofbiz/trunk/applications/accounting/widget/ap/InvoiceScreens.xml ofbiz/trunk/applications/accounting/widget/ap/forms/InvoiceForms.xml ofbiz/trunk/applications/accounting/widget/ar/InvoiceScreens.xml ofbiz/trunk/applications/accounting/widget/ar/forms/InvoiceForms.xml Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=835622&r1=835621&r2=835622&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Thu Nov 12 22:55:35 2009 @@ -5174,6 +5174,9 @@ <value xml:lang="th">à¹à¸à¸à¸³à¸à¸±à¸à¸à¸²à¸£à¸à¸²à¸¢</value> <value xml:lang="zh">éå®å票</value> </property> + <property key="AccountingInvoicesDueSoon"> + <value xml:lang="en">Invoices Due Soon</value> + </property> <property key="AccountingInvoiceStatus"> <value xml:lang="ar">اÙÙضعÙات</value> <value xml:lang="de">Status</value> @@ -7731,6 +7734,9 @@ <value xml:lang="th">à¸à¸¸à¸à¹à¸¡à¹à¹à¸à¹à¸£à¸±à¸à¸à¸à¸¸à¸à¸²à¸à¹à¸«à¹à¹à¸à¹à¸à¸²à¸à¹à¸à¸«à¸à¹à¸²à¸à¸µà¹ (PERIOD_MAINT à¸à¸µà¹à¸à¹à¸à¸à¸à¸²à¸£)</value> <value xml:lang="zh">ä½ æ²¡ææé使ç¨è¿ä¸ªé¡µé¢(éè¦PERIOD_MAINT)</value> </property> + <property key="AccountingPastDueInvoices"> + <value xml:lang="en">Past Due Invoices</value> + </property> <property key="AccountingOrgPartyId"> <value xml:lang="en">Org Party Id</value> <value xml:lang="fr">Réf. d'org.</value> Added: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy?rev=835622&view=auto ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy (added) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy Thu Nov 12 22:55:35 2009 @@ -0,0 +1,47 @@ +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.condition.EntityConditionList; +import org.ofbiz.entity.condition.EntityExpr; +import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.base.util.UtilDateTime; +import org.ofbiz.entity.util.EntityFindOptions; + +import javolution.util.FastList; +if (invoiceTypeId) { + List invoiceStatusesCondition = []; + invoiceStatusesCondition.add(EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, invoiceTypeId)); + if ("PURCHASE_INVOICE".equals(invoiceTypeId)) { + invoiceStatusesCondition.add(EntityCondition.makeCondition("statusId", EntityOperator.IN, ["INVOICE_RECEIVED", "INVOICE_IN_PROCESS"])); + } else if ("SALES_INVOICE".equals(invoiceTypeId)) { + invoiceStatusesCondition.add(EntityCondition.makeCondition("statusId", EntityOperator.IN, ["INVOICE_SENT", "INVOICE_APPROVED"])); + } + List pastDueInvoicesCondition = []; + pastDueInvoicesCondition.addAll(invoiceStatusesCondition); + pastDueInvoicesCondition.add(EntityCondition.makeCondition("dueDate", EntityOperator.LESS_THAN, UtilDateTime.nowTimestamp())); + invoicesCond = EntityCondition.makeCondition(pastDueInvoicesCondition, EntityOperator.AND); + PastDueInvoices = delegator.findList("Invoice", invoicesCond, null, ["dueDate DESC"], null, false); + if (PastDueInvoices) { + invoiceIds = PastDueInvoices.invoiceId; + totalAmount = dispatcher.runSync("getInvoiceRunningTotal", [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId, userLogin: userLogin]); + if (totalAmount) { + context.PastDueInvoicestotalAmount = totalAmount.invoiceRunningTotal; + } + context.PastDueInvoices = PastDueInvoices; + } + + List invoicesDueSoonCondition = []; + invoicesDueSoonCondition.addAll(invoiceStatusesCondition); + invoicesDueSoonCondition.add(EntityCondition.makeCondition("dueDate", EntityOperator.GREATER_THAN_EQUAL_TO, UtilDateTime.nowTimestamp())); + invoicesCond = EntityCondition.makeCondition(invoicesDueSoonCondition, EntityOperator.AND); + EntityFindOptions findOptions = new EntityFindOptions(); + findOptions.setMaxRows(10); + InvoicesDueSoon = delegator.findList("Invoice", invoicesCond, null, ["dueDate ASC"], findOptions, false); + if (InvoicesDueSoon) { + invoiceIds = InvoicesDueSoon.invoiceId; + totalAmount = dispatcher.runSync("getInvoiceRunningTotal", [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId, userLogin: userLogin]); + if (totalAmount) { + context.InvoicesDueSoonTotalAmount = totalAmount.invoiceRunningTotal; + } + context.InvoicesDueSoon = InvoicesDueSoon; + } +} Modified: ofbiz/trunk/applications/accounting/widget/ap/InvoiceScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ap/InvoiceScreens.xml?rev=835622&r1=835621&r2=835622&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/ap/InvoiceScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/ap/InvoiceScreens.xml Thu Nov 12 22:55:35 2009 @@ -25,20 +25,34 @@ <section> <actions> <set field="titleProperty" value="AccountingArPageTitleListReports"/> - <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/> <set field="tabButtonItem" value="viewReports"/> - <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="10"/> + <set field="invoiceTypeId" value="PURCHASE_INVOICE"/> + <set field="organizationPartyId" from-field="organizationPartyId" default-value="${defaultOrganizationPartyId}"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy"/> </actions> <widgets> <decorator-screen name="CommonApReportDecorator" location="${parameters.mainDecoratorLocation}"> <decorator-section name="body"> - <section> - <widgets> - <screenlet title="${uiLabelMap.AccountingReports}" navigation-form-name="ListReports"> + <screenlet title="${uiLabelMap.AccountingPastDueInvoices}: (${PastDueInvoicestotalAmount})" navigation-form-name="ListReports"> + <section> + <actions> + <set field="invoices" from-field="PastDueInvoices"/> + </actions> + <widgets> <include-form name="ListReports" location="component://accounting/widget/ap/forms/InvoiceForms.xml"/> - </screenlet> - </widgets> - </section> + </widgets> + </section> + </screenlet> + <screenlet title="${uiLabelMap.AccountingInvoicesDueSoon}: (${InvoicesDueSoonTotalAmount})" navigation-form-name="ListReports"> + <section> + <actions> + <set field="invoices" from-field="InvoicesDueSoon"/> + </actions> + <widgets> + <include-form name="ListReports" location="component://accounting/widget/ap/forms/InvoiceForms.xml"/> + </widgets> + </section> + </screenlet> </decorator-section> </decorator-screen> </widgets> Modified: ofbiz/trunk/applications/accounting/widget/ap/forms/InvoiceForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ap/forms/InvoiceForms.xml?rev=835622&r1=835621&r2=835622&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/ap/forms/InvoiceForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/ap/forms/InvoiceForms.xml Thu Nov 12 22:55:35 2009 @@ -20,18 +20,8 @@ <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd"> - <form name="ListReports" type="list" separate-columns="true" title="${uiLabelMap.AccountingInvoice} ${uiLabelMap.CommonList}" list-name="listIt" target="" default-entity-name="Invoice" + <form name="ListReports" type="list" separate-columns="true" title="${uiLabelMap.AccountingInvoice} ${uiLabelMap.CommonList}" list-name="invoices" target="" odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> - <actions> - <entity-condition entity-name="Invoice" list="invoices"> - <condition-list> - <condition-expr field-name="statusId" value="INVOICE_SENT"/> - <condition-expr field-name="dueDate" operator="greater" value="${nowTimestamp}"/> - </condition-list> - <order-by field-name="dueDate"/> - <limit-range start="0" size="10"/> - </entity-condition> - </actions> <row-actions> <service service-name="getPartyNameForDate" result-map="partyNameResultFrom"> <field-map field-name="partyId" from-field="partyIdFrom"/> Modified: ofbiz/trunk/applications/accounting/widget/ar/InvoiceScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ar/InvoiceScreens.xml?rev=835622&r1=835621&r2=835622&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/ar/InvoiceScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/ar/InvoiceScreens.xml Thu Nov 12 22:55:35 2009 @@ -26,17 +26,33 @@ <actions> <set field="headerItem" value="reports"/> <set field="titleProperty" value="AccountingArPageTitleListReports"/> + <set field="invoiceTypeId" value="SALES_INVOICE"/> + <set field="organizationPartyId" from-field="organizationPartyId" default-value="${defaultOrganizationPartyId}"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy"/> </actions> <widgets> <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> <decorator-section name="body"> - <screenlet title="${uiLabelMap.CommonList} ${uiLabelMap.AccountingReports}"> + <screenlet title="${uiLabelMap.AccountingPastDueInvoices}: (${PastDueInvoicestotalAmount})"> <section> + <actions> + <set field="invoices" from-field="PastDueInvoices"/> + </actions> <widgets> <include-form name="ListReports" location="component://accounting/widget/ar/forms/InvoiceForms.xml"/> </widgets> </section> </screenlet> + <screenlet title="${uiLabelMap.AccountingInvoicesDueSoon}: (${InvoicesDueSoonTotalAmount})"> + <section> + <actions> + <set field="invoices" from-field="InvoicesDueSoon"/> + </actions> + <widgets> + <include-form name="ListReports" location="component://accounting/widget/ar/forms/InvoiceForms.xml"/> + </widgets> + </section> + </screenlet> </decorator-section> </decorator-screen> </widgets> @@ -95,4 +111,4 @@ </section> </screen> -</screens> \ No newline at end of file +</screens> Modified: ofbiz/trunk/applications/accounting/widget/ar/forms/InvoiceForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ar/forms/InvoiceForms.xml?rev=835622&r1=835621&r2=835622&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/ar/forms/InvoiceForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/ar/forms/InvoiceForms.xml Thu Nov 12 22:55:35 2009 @@ -21,26 +21,8 @@ xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd"> <!-- show list of upto 10 Invoices past due for longest duration --> - <form name="ListReports" type="list" separate-columns="true" title="Invoice List" list-name="invoices" target="" default-entity-name="Invoice" + <form name="ListReports" type="list" separate-columns="true" title="Invoice List" list-name="invoices" target="" odd-row-style="alternate-row" default-table-style="basic-table hover-bar" paginate="true"> - <actions> - <entity-condition entity-name="Invoice" list="invoices"> - <condition-list> - <condition-expr field-name="invoiceTypeId" value="SALES_INVOICE"/> - <condition-list combine="or"> - <condition-expr field-name="statusId" value="INVOICE_SENT"/> - <condition-expr field-name="statusId" value="INVOICE_APPROVED"/> - </condition-list> - <condition-list combine="or"> - <condition-expr field-name="dueDate" operator="equals" from-field="nullField"/> - <condition-expr field-name="dueDate" operator="less" value="${nowTimestamp}"/> - </condition-list> - </condition-list> - <order-by field-name="dueDate"/> - <!-- <limit-range start="0" size="10"/> --> - <use-iterator/> - </entity-condition> - </actions> <row-actions> <service service-name="getPartyNameForDate" result-map="partyNameResultFrom"> <field-map field-name="partyId" from-field="partyIdFrom"/> |
Free forum by Nabble | Edit this page |