Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Show changed files | Directory listing | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
36419 7 d 17 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/digify/ OkHttp→HttpClientFactory migration for Digify controller  
36418 7 d 17 h amit /trunk/profitmandi-web/ OkHttp→Apache HttpClient migration. HyperTrackController/TrackingController now use RestClient, DB reads extracted to HyperTrackService to release connections before external HTTP calls. V2FofoDigifyController uses HttpClientFactory.  
36417 7 d 17 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/warehouse/ Fix:PO item swap — update/delete old PURCHASE scan record when reducing quantity on swapped inventory item  
36416 7 d 17 h amit /trunk/profitmandi-common/ Drop OkHttp, standardise on Apache HttpClient via HttpClientFactory. RestClient pool raised to 20/8, all construction routed through factory. Lint guard added to block direct OkHttp/createDefault usage.  
36415 7 d 18 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/integrations/gstpro/ GstProService: cancel EWB before IRN in within-24h cancellation

NIC rejects IRN cancellation with 'This IRN cannot be cancelled because
e-way bill has been generated' when an EWB is still active against the
invoice. Existing within-24h branch went straight to cancelIrn and hit
this rejection on every cancellation that had a generated EWB.

Mirror the DC branch's EWB-cancel pattern: when eInvoiceDetails.ewbNo is
non-null, resolve sellerGstin (prod gstin / sandbox), parse ewbNo, call
cancelEwb first, then proceed to cancelIrn. EWB-cancel is wrapped in
try/catch + WARN — already-cancelled EWBs (transient or manual) don't
block the IRN cancel that follows; a genuinely-active EWB still surfaces
via the IRN cancel error.
 
36414 7 d 18 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/warehouse/ without vendor catalog pricing po will not create  
36413 7 d 22 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/catalog/ Added Rising Star/NEW  
36412 7 d 22 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ Added Rising Star/NEW  
36411 7 d 22 h amit /trunk/ Fix lock contention: REQUIRES_NEW for wallet lock in createLoanForBilling, handle HDFC payment deadlock as duplicate  
36410 7 d 23 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/catalog/ Added Rising Star/NEW  
36409 8 d 15 h amit /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/controller/fofo/ V2 REST: mirror INV reject endpoint + restore !isShipped guard

/return/invoice/reject/{proId} — REST sibling of the fofo controller's
new endpoint. Finance-role-gated, requires non-blank rejectRemark.

/return/invoice/process — autoApprove now isIrnCancellable && !isShipped,
matching the fofo controller. Shipped goods route through manual approval
even within 24h.
 
36408 8 d 15 h amit /trunk/profitmandi-fofo/src/main/ Sale-return reversal: controller wiring + UI for cancellability gate + INV reject + date filter

PurchaseReturnController:
/return/invoice/process — autoApprove now isIrnCancellable && !isShipped.
!isShipped guard restored: shipped goods route through manual approval
even within 24h, so the physical return goes through CN flow.
/return/invoice/reject/{proId} — new endpoint for finance to reject a
pending INV PRO (sale stands, no inventory/wallet/GST action).
/return/invoice — date filter (fromDate/toDate query params, default
last 30 days) backed by selectByWarehouseIdsAndDateRange. Limit
bumped to 200 to accommodate longer ranges.
receive-debit-note view — passes $requiresFinanceApproval so the
template can render the finance-approval banner when DN's IRN is
past the 24h window.

invoice-return.vm:
Added From/To date inputs + Apply button.
Added Reject button next to Approve & Refund for pending INV PROs.

receive-debit-note.vm:
Added one informational banner (#if $requiresFinanceApproval) above
the receipt form. No layout / JS / submit-URL change.

return.js:
#invoice-return-date-apply handler — POSTs the selected range to
/return/invoice and refreshes the table.
.reject-invoice-return handler — prompts for reason, calls the new
reject endpoint.

dev/staging/prod.properties: feature flag finance.receipt.approval.email.enabled
(default false, flip per env when mail infra is ready).
 
36407 8 d 15 h amit /trunk/profitmandi-dao/src/main/ Sale-return reversal: cancellability gate, CN on approve, INV reject, ROI semantics

GstProService.isIrnCancellable(invoiceNumber): predicate extracted from
the inline 24h check used in cancelInvoiceGst, so callers outside the
service can decide branching without duplicating the rule. DC and no-IRN
cases return false — those paths use EWB cancel / credit-note issuance.

PurchaseReturnServiceImpl: split single-phase return-receive into
submitReceiptForApproval + applyReceipt. Submit persists per-item return
type on PurchaseReturnItem so apply (called inline on auto-approve, or
later from refundOrder when finance clicks Process Refund) can replay
the scan loop without the original itemReturnTypes map.

processInvoiceReturn(autoApprove=true) no longer creates a PRO. Routes
through new cancelInvoiceFully which calls gstProService.cancelInvoiceGst
(the canonical IRN-cancel path setting Order.status=INVOICE_CANCELLED)
and adds wallet credit + warehouse-stock restoration. Cancellations now
live on Order/EInvoiceDetails screens, not in the returns ledger —
matches standard ERP practice and the existing cancelInvoiceGst flow.

processInvoiceReturn(autoApprove=false) creates an INV-prefix PRO in
pending state and calls notifyFinanceApprovalPending (Finance L1+L2
emails resolved dynamically from PositionRepository).

approveInvoiceReturn now runs applyInvoiceReturnViaCreditNote — raises
local CreditNote + CreditNoteLine rows (sequential CN# from
SellerWarehouse), issues CRN at GST via generateCreditNoteIrn, restores
warehouse stock, populates ReturnOrderInfo (this path IS a customer
return without DN — ROI is the right anchor), credits wallet. Drops the
old applyInvoiceReturnEffects helper which mishandled both cancel and
return-via-CN as the same path.

rejectInvoiceReturn: new method for finance to reject pending INV PROs.
Sale stands — only stamps reject_timestamp/reject_remark. No inventory,
no wallet, no GST action, no ROI. Closes the gap where finance had
Approve as the only option on a pending INV PRO.

refundOrder gains a refund guard (PRO must exist, not refunded, not
rejected) and applyReceipt-if-needed at the top — Finance's existing
Process Refund button now drives approve+refund atomically.

PurchaseReturnOrderRepository.selectByWarehouseIdsAndDateRange: Hibernate
query for a date-range listing on /return/invoice (default last 30
days, limit 200).

@Transactional(rollbackFor=Exception.class) at class level —
ProfitMandiBusinessException is checked, so Spring's default rollback
didn't fire on guard failures, allowing partial commits. Closing that
silently broken behaviour.

LineItemImei N+1 fix: receiveDebitNoteItems / refundOrder / rejectReturn
each iterated orders calling selectByLineItemId per row. Switched to the
existing batch selectByLineItemIds(List).

Email template finance-receipt-approval-pending.vm and SQL migration
migration_imei_net_margin_modal_api.sql added (registers the
/getImeiNetMarginModal endpoint in dtr.api and grants access to the
roles that currently access /order).
 
36406 8 d 17 h amit /trunk/profitmandi-dao/src/main/resources/sql/ Add scheme_item windowing migration script.

Migrates fofo.scheme_item from composite (scheme_id, catalog_id) PK to
surrogate id BIGINT, adds audit columns, swaps the old uniqueness to
the 4-column window key, adds a date-driven lookup index, and installs
BEFORE INSERT/UPDATE triggers that enforce start<=end, containment in
parent scheme window, and non-overlap within (catalog_id, scheme_id).

Step 4b drops the legacy UNIQUE scheme_catalog (scheme_id, catalog_id);
without this the windowing feature is functionally blocked.

Applied on hadb1 in this revision.
 
36405 8 d 17 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Fix duplicate SchemeInOut on concurrent GRN: SELECT FOR UPDATE on inventory_item before createSchemeInOut to serialise concurrent GRN calls per IMEI  
36404 8 d 20 h amit /trunk/profitmandi-fofo/src/ Add catalog monitor type upload, sample sheet, Placement Plan UI tagging (orange/yellow), Today PO csv column, placement-plan-statement.xlsx header coloring  
36403 8 d 20 h amit /trunk/profitmandi-dao/src/main/ Add catalog.catalog_monitor_type table, entity, and repository for per-catalog focused/normal monitor type tagging  
36402 8 d 20 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/ Replace mailSender (SendGrid) with gmailRelaySender - SendGrid API key expired/revoked  
36401 8 d 20 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ Replace mailSender (SendGrid) with gmailRelaySender - SendGrid API key expired/revoked  
36400 8 d 20 h amit /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/ Replace mailSender (SendGrid) with gmailRelaySender - SendGrid API key expired/revoked  

Show All