<?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/sql/backfill_debit_note_status_old_flow_20260924.sql</title><description>WebSVN RSS feed &#x2013; SmartDukaan</description><lastBuildDate>Thu, 08 Oct 2026 00:26:06 +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%2Fsql%2Fbackfill_debit_note_status_old_flow_20260924.sql&amp;max=40&amp;</link><atom:link href="https://svn.smartdukaan.com/rss.php?path=%2Ftrunk%2Fprofitmandi-dao%2Fsrc%2Fmain%2Fresources%2Fsql%2Fbackfill_debit_note_status_old_flow_20260924.sql&amp;repname=SmartDukaan" rel="self" type="application/rss+xml" />
<item><pubDate>Mon, 28 Sep 2026 16:50:59 +0530</pubDate><dc:creator>amit</dc:creator><title>Rev 37797 – Stop a settled debit note being received a second time ...</title><description>&lt;div&gt;&lt;strong&gt;amit – 3 file(s) modified&lt;/strong&gt;&lt;br/&gt;Stop a settled debit note being received a second time&lt;br /&gt;
&lt;br /&gt;
A return settled before the receive workflow (first purchase_return_order&lt;br /&gt;
2026-03-16) wrote the warehouse SALE_RET scan, a returnorderinfo row and a&lt;br /&gt;
wallet refund, but never touched the debit note: it stayed CREATED with no&lt;br /&gt;
purchase_return_order. Those are exactly the two things the receive screens&lt;br /&gt;
read, so 5,557 fully settled notes looked like they were still awaiting&lt;br /&gt;
receipt, Receive button included.&lt;br /&gt;
&lt;br /&gt;
Receiving one of them (DN UPBLY975/4, IMEI 864973083197734, Antu Enterprises)&lt;br /&gt;
restored to the partner a phone that had already been returned, refunded&lt;br /&gt;
Rs 38,999 and resold to another partner, and a duplicate debit note followed&lt;br /&gt;
that Finance could not refund.&lt;br /&gt;
&lt;br /&gt;
- receiveDebitNoteItems: refuse a note that already has a return order, one&lt;br /&gt;
  whose status is not CREATED, and one whose every unit is already back at the&lt;br /&gt;
  warehouse. Checked BEFORE the condition-mismatch gate - a mismatch there&lt;br /&gt;
  returns into rejectOnConditionMismatch without reaching any later check, and&lt;br /&gt;
  acknowledging that rejection hands the stock back to the partner. That is&lt;br /&gt;
  how the Antu case slipped through.&lt;br /&gt;
- getAlreadyReturnedDebitNotes: the last of those checks, batched for a page of&lt;br /&gt;
  notes. Mirrors applyReceipt - SALE_RET/DOA_IN/SALE_RET_UNUSABLE for the unit&lt;br /&gt;
  against the order its invoice was billed on - so a screen can never disagree&lt;br /&gt;
  with what the refund step will accept.&lt;br /&gt;
- processInvoiceReturn: one open return per document.&lt;br /&gt;
- sql/backfill_debit_note_status_old_flow_20260924.sql: APPLIED on hadb1&lt;br /&gt;
  2026-09-24. 4,154 notes -&gt; APPROVED, 6,639 items -&gt; RETURNED, on the same&lt;br /&gt;
  evidence (returned and refunded). Open notes 5,557 -&gt; 1,404; the rest are&lt;br /&gt;
  left CREATED for review, bucketed in fofo._dn_backfill_20260922.&lt;/div&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/sql/backfill_debit_note_status_old_flow_20260924.sql&lt;br /&gt;</description><link>https://svn.smartdukaan.com/revision.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-dao%2Fsrc%2Fmain%2Fresources%2Fsql%2Fbackfill_debit_note_status_old_flow_20260924.sql&amp;rev=37797</link><guid>https://svn.smartdukaan.com/revision.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-dao%2Fsrc%2Fmain%2Fresources%2Fsql%2Fbackfill_debit_note_status_old_flow_20260924.sql&amp;rev=37797</guid></item>
</channel></rss>