📄 reconcileglaccountorganization.ftl
字号:
<p/><#-- Entry Header Table --><div class="scroll"><table border="1" cellpadding="2" cellspacing="0" class="calendarTable" width="98%"> <tr align="center"> <td><span class="tableheadtext">Organization</span></td> <td><span class="tableheadtext">Party</span></td> <td><span class="tableheadtext">Transaction ID</span></td> <td><span class="tableheadtext">Transaction Type</span></td> <td><span class="tableheadtext">Transaction Date</span></td> <td><span class="tableheadtext">Debit</span></td> <td><span class="tableheadtext">Credit</span></td> <td><span class="tableheadtext">Reconcile</span></td> </tr> <#-- Entries --> <#assign rowCount = 0 /> <#list entries as entry> <#-- assign some alternating colors --> <#if rowCount % 2 == 0> <#assign graycycle = "gray1"/> <#assign redcycle = "red1"/> <#assign bluecycle = "blue1"/> <#else> <#assign graycycle = "gray2"/> <#assign redcycle = "red2"/> <#assign bluecycle = "blue2"/> </#if> <#-- special form data for service-multi updateAcctTransEntries --> <input type="hidden" name="acctgTransId_o_${rowCount}" value="${entry.acctgTransId}"/> <input type="hidden" name="acctgTransEntrySeqId_o_${rowCount}" value="${entry.acctgTransEntrySeqId}"/> <input type="hidden" name="amount_o_${rowCount}" value="${entry.amount?string("0.00")}"/> <input type="hidden" name="reconcileStatusId_o_${rowCount}" value="${entry.reconcileStatusId?if_exists}"/> <#-- special form data for reconcileGlAccount: entry_id_(index) stores the transaction ID pair --> <input type="hidden" name="entry_id_${rowCount}" value="${entry.acctgTransId}|${entry.acctgTransEntrySeqId}"/> <#-- check entry by default if partly reconciled and set special input fields _atei to transaction IDs if checked --> <#if entry.reconcileStatusId?exists && (entry.reconcileStatusId == "AES_PARTLY_RECON")> <#assign checked="checked"/> <input type="hidden" name="${rowCount}_atei" value="${entry.acctgTransId}|${entry.acctgTransEntrySeqId}"/> <#else> <#assign checked=""/> <input type="hidden" name="${rowCount}_atei" value=""/> </#if> <#-- entry display (note: checkbox value is the row/entry index) --> <tr> <td class="${graycycle}"><span class="tabletext">${entry.organizationPartyId}</span></td> <td class="${graycycle}"><span class="tabletext"><#if entry.partyId?exists>${entry.partyId}<#else> </#if></span></td> <td class="${graycycle}"><span class="tabletext"> <a target="_blank" href="<@ofbizUrl>viewAcctgTrans?acctgTransId=${entry.acctgTransId}</@ofbizUrl>">${entry.acctgTransId}</a> </span></td> <td class="${graycycle}"><span class="tabletext">${entry.getRelatedOneCache("AcctgTransType").getString("description")}</span></td> <td class="${graycycle}"><span class="tabletext">${entry.transactionDate?string.short}</span></td> <#if entry.debitCreditFlag == "D"> <td class="${redcycle}"><span class="tabletext">${entry.amount}</span></td> <td class="${bluecycle}"><span class="tabletext"> </span></td> <td class="${graycycle}" align="center"><span class="tabletext"> <input type="checkbox" ${checked} name="_rowSubmit_o_${rowCount}" value="${rowCount}" onClick="javascript:toggleEntry(this)"/> </span></td> <#else> <td class="${redcycle}"><span class="tabletext"> </span></td> <td class="${bluecycle}"><span class="tabletext">${entry.amount}</span></td> <td class="${graycycle}" align="center"><span class="tabletext"> <input type="checkbox" ${checked} name="_rowSubmit_o_${rowCount}" value="${rowCount}" onClick="javascript:toggleEntry(this)"/> </span></td> </#if> <input type="hidden" name="debitCreditFlag${rowCount}" value="${entry.debitCreditFlag}"/> </tr> <#assign rowCount = rowCount + 1 /> </#list> <#-- some final form data --> <input type="hidden" name="_rowCount" value="${rowCount}"/> <input type="hidden" name="_useRowSubmit" value="N"/> <input type="hidden" name="glAccountId" value="${glAccount.glAccountId}"/></table></div><#-- javascript goes here due to dependancy on rowCount value --><script language="javascript">function uncheckAll(form) { for (var i = 0; i < ${rowCount}; i++) { form.elements['_rowSubmit_o_' + i].checked = false; form.elements['reconcileStatusId_o_' + i].value = "AES_NOT_RECONCILED"; form.elements[i + '_atei'].value = ""; } recalculateEntries(form);}function checkAll(form) { for (var i = 0; i < ${rowCount}; i++) { form.elements['_rowSubmit_o_' + i].checked = true; form.elements['reconcileStatusId_o_' + i].value = "AES_PARTLY_RECON"; form.elements[i + '_atei'].value = form.elements['entry_id_' + i].value; } recalculateEntries(form);}<#-- This called is when users work with the balance; It does javascript validation on the number format, then recomputes the balances. The last step is to call recalculateEntries to add the entries.-->function recalculateBalance(form) { beginningBalance = (form.beginningBalance.value - 0); if (isNaN(beginningBalance)) { beginningBalance = (form.lastReconciledBalance.value - 0); } form.beginningBalance.value = beginningBalance.toFixed(2); endingBalance = (form.endingBalance.value - 0); if (isNaN(endingBalance)) { endingBalance = 0; } form.endingBalance.value = endingBalance.toFixed(2); recalculateEntries(form); }<#-- This method is called whenever any form fields are toggled/changed by user. Computes net balance and difference for each checked acctgTransEntry. Afterwards, determines whether to enable/disable Reconcile button.-->function recalculateEntries(form) { reconciledBalance = (form.beginningBalance.value - 0); if (isNaN(reconciledBalance)) { reconciledBalance = form.lastReconciledBalance.value; } checked = 0; for (var i=0; i < ${rowCount}; i++) { if (form.elements['_rowSubmit_o_' + i].checked) { checked += 1; <#-- To cut down on javascript, we determine the type of account in freemarker and pick which javascript logic to use. In the case of debit accounts (first case), we want the balance to add debits and subtract credits. --> <#if accountIsDebit == "TRUE"> if (form.elements['debitCreditFlag' + i].value == 'D') { // increase in debit is increase in balance for accounts of type DEBIT reconciledBalance += (form.elements['amount_o_' + i].value - 0); } else { // increase in credit is descrease in balance for accounts of type DEBIT reconciledBalance -= (form.elements['amount_o_' + i].value - 0); } <#else> <#-- otherwise we want balance to add credits and subtract debits --> if (form.elements['debitCreditFlag' + i].value == 'D') { // increase in debit is descrease in balance for accounts of type CREDIT reconciledBalance -= (form.elements['amount_o_' + i].value - 0); } else { // increase in credit is increase in balance for accounts of type CREDIT reconciledBalance += (form.elements['amount_o_' + i].value - 0); } </#if> } } form.reconciledBalance.value = reconciledBalance.toFixed(2); difference = form.endingBalance.value - form.reconciledBalance.value; form.difference.value = difference.toFixed(2); // finally, we check if we should let user Reconcile if (checked > 0) { checkAllowReconcile(form); } else { // handle the false case of checkAllowReconcile here (because it doesn't count checked boxes) form.reconcile.disabled = true; form.reconcile.className = "smallSubmit smallSubmitDisabled"; }}<#-- Checks to see if Reconcile button should be enabled, but does not count checkboxes. -->function checkAllowReconcile(form) { difference = (form.difference.value - 0); if ((difference == 0) && (form.reconciledDate.value.length > 0)) { form.reconcile.disabled = false; form.reconcile.className = "smallSubmit"; } else { form.reconcile.disabled = true; form.reconcile.className = "smallSubmit smallSubmitDisabled"; }}<#-- Called when user clicks on a checkbox. If checked, this will set the reconcileStatusId to partly reconciled and sets the special field sequence index_atei to the transaction ID pair. If unchecked, it nulls out the relevant _atei field and sets status to not reconciled. Finally, it recalculates the balance.-->function toggleEntry(element) { form = element.form; index = (element.value - 0); // note: checkbox value is the row index if (element.checked) { form.elements['reconcileStatusId_o_' + index].value = "AES_PARTLY_RECON"; form.elements[index + '_atei'].value = form.elements['entry_id_' + index].value; } else { form.elements['reconcileStatusId_o_' + index].value = "AES_NOT_RECONCILED"; form.elements[index + '_atei'].value = ""; } recalculateEntries(element.form);}<#-- on save, call updateAcctgTransEntry to update changes in reconciled status -->function submitSave(form) { form.action = "<@ofbizUrl>updateAcctgTransEntries</@ofbizUrl>"; form.submit();}<#-- on reconcile, call reconcileGlAccount, which takes care of everything from here -->function submitReconcile(form) { // tricky problem: must enable reconciledBalance or it won't get submitted! form.reconciledBalance.disabled = false; form.action = "<@ofbizUrl>reconcileGlAccount</@ofbizUrl>"; form.submit();}</script><#else> <p><span class="tableheadtext">No accounting transactions to reconcile for this account.</span></p></#if> <#-- END ENTRIES EXIST --></td></tr></table></td></tr></table></form>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -