<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>SmartDukaan &#x2013; /trunk/profitmandi-dao/src/main/resources/finance-receipt-approval-pending.vm</title><description>WebSVN RSS feed &#x2013; SmartDukaan</description><lastBuildDate>Wed, 06 May 2026 14:37:27 +0530</lastBuildDate><generator>WebSVN 2.8.6-DEV</generator><language>en</language><link>https://svn.smartdukaan.com/log.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-dao%2Fsrc%2Fmain%2Fresources%2Ffinance-receipt-approval-pending.vm&amp;max=40&amp;</link><atom:link href="https://svn.smartdukaan.com/rss.php?path=%2Ftrunk%2Fprofitmandi-dao%2Fsrc%2Fmain%2Fresources%2Ffinance-receipt-approval-pending.vm&amp;repname=SmartDukaan" rel="self" type="application/rss+xml" />
<item><pubDate>Mon, 27 Apr 2026 19:54:23 +0530</pubDate><dc:creator>amit</dc:creator><title>Rev 36407 – Sale-return reversal: cancellability gate, CN on approve, INV reject, ROI ...</title><description>&lt;div&gt;&lt;strong&gt;amit – 6 file(s) modified&lt;/strong&gt;&lt;br/&gt;Sale-return reversal: cancellability gate, CN on approve, INV reject, ROI semantics&lt;br /&gt;
&lt;br /&gt;
GstProService.isIrnCancellable(invoiceNumber): predicate extracted from&lt;br /&gt;
the inline 24h check used in cancelInvoiceGst, so callers outside the&lt;br /&gt;
service can decide branching without duplicating the rule. DC and no-IRN&lt;br /&gt;
cases return false — those paths use EWB cancel / credit-note issuance.&lt;br /&gt;
&lt;br /&gt;
PurchaseReturnServiceImpl: split single-phase return-receive into&lt;br /&gt;
submitReceiptForApproval + applyReceipt. Submit persists per-item return&lt;br /&gt;
type on PurchaseReturnItem so apply (called inline on auto-approve, or&lt;br /&gt;
later from refundOrder when finance clicks Process Refund) can replay&lt;br /&gt;
the scan loop without the original itemReturnTypes map.&lt;br /&gt;
&lt;br /&gt;
processInvoiceReturn(autoApprove=true) no longer creates a PRO. Routes&lt;br /&gt;
through new cancelInvoiceFully which calls gstProService.cancelInvoiceGst&lt;br /&gt;
(the canonical IRN-cancel path setting Order.status=INVOICE_CANCELLED)&lt;br /&gt;
and adds wallet credit + warehouse-stock restoration. Cancellations now&lt;br /&gt;
live on Order/EInvoiceDetails screens, not in the returns ledger —&lt;br /&gt;
matches standard ERP practice and the existing cancelInvoiceGst flow.&lt;br /&gt;
&lt;br /&gt;
processInvoiceReturn(autoApprove=false) creates an INV-prefix PRO in&lt;br /&gt;
pending state and calls notifyFinanceApprovalPending (Finance L1+L2&lt;br /&gt;
emails resolved dynamically from PositionRepository).&lt;br /&gt;
&lt;br /&gt;
approveInvoiceReturn now runs applyInvoiceReturnViaCreditNote — raises&lt;br /&gt;
local CreditNote + CreditNoteLine rows (sequential CN# from&lt;br /&gt;
SellerWarehouse), issues CRN at GST via generateCreditNoteIrn, restores&lt;br /&gt;
warehouse stock, populates ReturnOrderInfo (this path IS a customer&lt;br /&gt;
return without DN — ROI is the right anchor), credits wallet. Drops the&lt;br /&gt;
old applyInvoiceReturnEffects helper which mishandled both cancel and&lt;br /&gt;
return-via-CN as the same path.&lt;br /&gt;
&lt;br /&gt;
rejectInvoiceReturn: new method for finance to reject pending INV PROs.&lt;br /&gt;
Sale stands — only stamps reject_timestamp/reject_remark. No inventory,&lt;br /&gt;
no wallet, no GST action, no ROI. Closes the gap where finance had&lt;br /&gt;
Approve as the only option on a pending INV PRO.&lt;br /&gt;
&lt;br /&gt;
refundOrder gains a refund guard (PRO must exist, not refunded, not&lt;br /&gt;
rejected) and applyReceipt-if-needed at the top — Finance&apos;s existing&lt;br /&gt;
Process Refund button now drives approve+refund atomically.&lt;br /&gt;
&lt;br /&gt;
PurchaseReturnOrderRepository.selectByWarehouseIdsAndDateRange: Hibernate&lt;br /&gt;
query for a date-range listing on /return/invoice (default last 30&lt;br /&gt;
days, limit 200).&lt;br /&gt;
&lt;br /&gt;
@Transactional(rollbackFor=Exception.class) at class level —&lt;br /&gt;
ProfitMandiBusinessException is checked, so Spring&apos;s default rollback&lt;br /&gt;
didn&apos;t fire on guard failures, allowing partial commits. Closing that&lt;br /&gt;
silently broken behaviour.&lt;br /&gt;
&lt;br /&gt;
LineItemImei N+1 fix: receiveDebitNoteItems / refundOrder / rejectReturn&lt;br /&gt;
each iterated orders calling selectByLineItemId per row. Switched to the&lt;br /&gt;
existing batch selectByLineItemIds(List).&lt;br /&gt;
&lt;br /&gt;
Email template finance-receipt-approval-pending.vm and SQL migration&lt;br /&gt;
migration_imei_net_margin_modal_api.sql added (registers the&lt;br /&gt;
/getImeiNetMarginModal endpoint in dtr.api and grants access to the&lt;br /&gt;
roles that currently access /order).&lt;/div&gt;~ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/fofo/PurchaseReturnOrderRepository.java&lt;br /&gt;~ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/fofo/PurchaseReturnOrderRepositoryImpl.java&lt;br /&gt;~ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/inventory/PurchaseReturnService.java&lt;br /&gt;~ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/inventory/PurchaseReturnServiceImpl.java&lt;br /&gt;+ /trunk/profitmandi-dao/src/main/resources/finance-receipt-approval-pending.vm&lt;br /&gt;+ /trunk/profitmandi-dao/src/main/resources/sql/migration_imei_net_margin_modal_api.sql&lt;br /&gt;</description><link>https://svn.smartdukaan.com/revision.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-dao%2Fsrc%2Fmain%2Fresources%2Ffinance-receipt-approval-pending.vm&amp;rev=36407</link><guid>https://svn.smartdukaan.com/revision.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-dao%2Fsrc%2Fmain%2Fresources%2Ffinance-receipt-approval-pending.vm&amp;rev=36407</guid></item>
</channel></rss>