File size: 71,468 Bytes
2f5dcf7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
��

��������������������������������������������������������� DATABASE SCHEMA SUMMARY ���������������������������������������������������������������������������������������������

��� 1. parties         ��� Party master: id, name, phone, city, party_type,  ���

���                      past_due, is_active, previous_names (JSON)         ���

��� 2. mirchi_types    ��� Mirchi varieties: id, name, is_active              ���

��� 3. transactions    ��� Awaak/Jawaak bills: bill_number, bill_date,        ���

���                      bill_type(awaak|jawaak), party_id, total_amount,   ���

���                      paid_amount, balance_amount, expenses(JSON),       ���

���                      lot_number, is_mixed, is_return                     ���

��� 4. transaction_items  ��� Line items: mirchi_name, poti_count,            ���

���                         poti_weights, net_weight, rate_per_kg, amount   ���

��� 5. transaction_payments ��� Payments per bill: amount, mode, reference,   ���

���                           is_reversed                                    ���

��� 6. patti_transactions ��� Patti bills (patti_awaak|patti_jawaak):        ���

���                         same as transactions + gross_weight,            ���

���                         verified_net_weight                              ���

��� 7. patti_transaction_items ��� Same structure as transaction_items        ���

��� 8. party_jama_entries  ��� Standalone payments: party_id, date, amount,  ���

���                          reference, notes                                ���

��� 9. stock_ledger    ��� Stock movements: mirchi_name, movement_type        ���

���                      (IN|OUT|RETURN_IN|RETURN_OUT), quantity_in/out,    ���

���                      balance_after, lot_number                           ���

��� 10.bill_number_sequences ��� Auto-numbering: bill_type, year, batch(A-Z),���

���                            current_number (resets at 500 ��� next batch) ���

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������





============================================================

  LIVE DATABASE TABLES (11 tables found)

============================================================



a"��� ALEMBIC_VERSION  (1 rows)

   Column                              Type                      Nullable

   ----------------------------------- ------------------------- --------

   version_num                         character varying         NO 



a"��� BILL_NUMBER_SEQUENCES  (4 rows)

   Column                              Type                      Nullable

   ----------------------------------- ------------------------- --------

   id                                  integer                   NO 

   bill_type                           character varying         NO 

   year                                integer                   NO 

   batch                               character varying         NO 

   current_number                      integer                   NO 

   is_full                             boolean                   NO 

   created_at                          timestamp with time zone  NO 

   updated_at                          timestamp with time zone  NO 



a"��� MIRCHI_TYPES  (5 rows)

   Column                              Type                      Nullable

   ----------------------------------- ------------------------- --------

   id                                  character varying         NO 

   name                                character varying         NO 

   is_active                           boolean                   NO 

   created_at                          timestamp with time zone  NO 

   updated_at                          timestamp with time zone  NO 



a"��� PARTIES  (6 rows)

   Column                              Type                      Nullable

   ----------------------------------- ------------------------- --------

   id                                  character varying         NO 

   name                                character varying         NO 

   previous_names                      json                      YES

   phone                               character varying         NO 

   city                                character varying         YES

   party_type                          USER-DEFINED              NO 

   past_due                            double precision          NO 

   notes                               text                      YES

   is_active                           boolean                   NO 

   created_at                          timestamp with time zone  NO 

   updated_at                          timestamp with time zone  NO 



a"��� PARTY_JAMA_ENTRIES  (12 rows)

   Column                              Type                      Nullable

   ----------------------------------- ------------------------- --------

   id                                  character varying         NO 

   party_id                            character varying         NO 

   date                                character varying         NO 

   amount                              double precision          NO 

   reference                           character varying         YES

   notes                               text                      YES

   created_at                          timestamp with time zone  NO 

   updated_at                          timestamp with time zone  NO 



a"��� PATTI_TRANSACTION_ITEMS  (6 rows)

   Column                              Type                      Nullable

   ----------------------------------- ------------------------- --------

   id                                  character varying         NO 

   transaction_id                      character varying         NO 

   mirchi_name                         character varying         NO 

   mirchi_id                           character varying         YES

   poti_count                          integer                   NO 

   poti_weights                        text                      YES

   net_weight                          double precision          NO 

   rate_per_kg                         double precision          NO 

   amount                              double precision          NO 



a"��� PATTI_TRANSACTIONS  (6 rows)

   Column                              Type                      Nullable

   ----------------------------------- ------------------------- --------

   id                                  character varying         NO 

   bill_number                         character varying         NO 

   bill_date                           character varying         NO 

   bill_type                           USER-DEFINED              NO 

   party_id                            character varying         NO 

   party_name                          character varying         NO 

   party_name_current                  character varying         NO 

   party_phone                         character varying         NO 

   subtotal                            double precision          NO 

   total_amount                        double precision          NO 

   paid_amount                         double precision          NO 

   balance_amount                      double precision          NO 

   expenses                            json                      YES

   lot_number                          character varying         YES

   gross_weight                        double precision          YES

   verified_net_weight                 double precision          YES

   is_return                           boolean                   NO 

   original_bill_id                    character varying         YES

   return_bill_id                      character varying         YES

   created_at                          timestamp with time zone  NO 

   updated_at                          timestamp with time zone  NO 

   payment_method                      character varying         YES



a"��� STOCK_LEDGER  (19 rows)

   Column                              Type                      Nullable

   ----------------------------------- ------------------------- --------

   id                                  character varying         NO 

   mirchi_name                         character varying         NO 

   mirchi_id                           character varying         YES

   transaction_id                      character varying         YES

   patti_transaction_id                character varying         YES

   movement_type                       character varying         NO 

   quantity_in                         double precision          NO 

   quantity_out                        double precision          NO 

   balance_after                       double precision          NO 

   lot_number                          character varying         YES

   created_at                          timestamp with time zone  NO 



a"��� TRANSACTION_ITEMS  (13 rows)

   Column                              Type                      Nullable

   ----------------------------------- ------------------------- --------

   id                                  character varying         NO 

   transaction_id                      character varying         NO 

   mirchi_name                         character varying         NO 

   mirchi_id                           character varying         YES

   poti_count                          integer                   NO 

   poti_weights                        text                      YES

   net_weight                          double precision          NO 

   rate_per_kg                         double precision          NO 

   amount                              double precision          NO 

   source                              character varying         YES



a"��� TRANSACTION_PAYMENTS  (14 rows)

   Column                              Type                      Nullable

   ----------------------------------- ------------------------- --------

   id                                  character varying         NO 

   transaction_id                      character varying         NO 

   amount                              double precision          NO 

   mode                                character varying         NO 

   reference                           character varying         YES

   paid_at                             character varying         YES

   is_reversed                         boolean                   NO 

   reversed_at                         timestamp with time zone  YES

   created_at                          timestamp with time zone  NO 



a"��� TRANSACTIONS  (11 rows)

   Column                              Type                      Nullable

   ----------------------------------- ------------------------- --------

   id                                  character varying         NO 

   bill_number                         character varying         NO 

   bill_date                           character varying         NO 

   bill_type                           USER-DEFINED              NO 

   party_id                            character varying         NO 

   party_name                          character varying         NO 

   party_name_current                  character varying         NO 

   party_phone                         character varying         NO 

   subtotal                            double precision          NO 

   total_amount                        double precision          NO 

   paid_amount                         double precision          NO 

   balance_amount                      double precision          NO 

   expenses                            json                      YES

   lot_number                          character varying         YES

   is_mixed                            boolean                   NO 

   is_return                           boolean                   NO 

   original_bill_id                    character varying         YES

   return_bill_id                      character varying         YES

   created_at                          timestamp with time zone  NO 

   updated_at                          timestamp with time zone  NO 

   payment_method                      character varying         YES



======================================================================

  MIRCHI TRADING ��� ALL API ENDPOINTS + EXAMPLE RESPONSES

======================================================================

  Base URL: http://localhost:8000





[01] GET /api/parties

      ��% List all parties (with live current_balance)

      Params: party_type, search, skip, limit

      Response: {

        "success": true,

        "data": [

                {

                        "id": "p-abc123",

                        "name": "���%��[%������%��[%���% ���������%���������%�����U%",

                        "phone": "9876543210",

                        "city": "�����[%������������",

                        "party_type": "both",

         ...

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[02] GET /api/parties/{party_id}

      ��% Single party with computed current_balance

      Response: {

        "success": true,

        "data": {

                "id": "p-abc123",

                "name": "���%��[%������%��[%���% ���������%���������%�����U%",

                "phone": "9876543210",

                "city": "�����[%������������",

                "party_type": "both",

                "past_due": 5000.0,

                "current_balanc...

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[03] GET /api/parties/{party_id}/name-history

      ��% Full rename history for a party

      Response: {

        "party_id": "p-abc123",

        "current_name": "���%��[%������%��[%���% ���������%���������%�����U%",

        "name_history": [

                "���%��[%������%��[%���%",

                "���%��[%������%��[%���% ������������%���������%��[%�����������U%"

        ]

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[04] POST /api/parties

      ��% Create a new party

      Body: {

        "name": "��b%��������[%��� ���������%���������%�����U%",

        "phone": "9988776655",

        "city": "���%��[%���������%",

        "party_type": "jawaak",

        "past_due": 0.0

}

      Response: {

        "success": true,

        "message": "Party created successfully",

        "data": {

                "id": "p-xyz789",

                "name": "��b%��������[%��� ���������%���������%�����U%"

        }

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[05] PUT /api/parties/{party_id}

      ��% Update party (rename auto-saves to history)

      Body: {

        "name": "��b%��������[%��� ������������%���������%��[%�����������U%",

        "phone": "9988776655"

}

      Response: {

        "success": true,

        "message": "Party updated successfully"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[06] DELETE /api/parties/{party_id}

      ��% Soft-delete a party (sets is_active=False)

      Response: {

        "success": true,

        "message": "Party deactivated successfully"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[07] GET /api/mirchi-types

      ��% List mirchi varieties

      Params: active_only=true, skip, limit

      Response: {

        "success": true,

        "data": [

                {

                        "id": "m-aaa111",

                        "name": "���%��[%���% �����%���%������",

                        "is_active": true

                },

                {

                        "id": "m-bbb222",

                        "name...

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[08] GET /api/mirchi-types/{mirchi_id}

      ��% Single mirchi type by ID

      Response: {

        "success": true,

        "data": {

                "id": "m-aaa111",

                "name": "���%��[%���% �����%���%������",

                "is_active": true

        }

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[09] POST /api/mirchi-types

      ��% Create new mirchi type

      Body: {

        "name": "�����[%��%��� �����%���%������"

}

      Response: {

        "success": true,

        "message": "Mirchi type created successfully",

        "data": {

                "id": "m-ccc333",

                "name": "�����[%��%��� �����%���%������"

        }

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[10] PUT /api/mirchi-types/{mirchi_id}

      ��% Update mirchi type name or active status

      Body: {

        "name": "�����[%��%��� �����%���%������ XL",

        "is_active": true

}

      Response: {

        "success": true,

        "message": "Mirchi type updated successfully"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[11] DELETE /api/mirchi-types/{mirchi_id}

      ��% Hard delete a mirchi type

      Response: {

        "success": true,

        "message": "Mirchi type deleted successfully"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[12] GET /api/transactions

      ��% List all transactions with filters

      Params: bill_type(awaak|jawaak), party_id, search, start_date, end_date, skip, limit

      Response: {

        "success": true,

        "data": [

                {

                        "id": "t-111aaa",

                        "bill_number": "A2025A001",

                        "bill_date": "2025-03-15",

                        "bill_type": "awaak",

                        "party_id": "p-abc123"...

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[13] GET /api/transactions/next-bill-number

      ��% Get next auto-generated bill number

      Params: bill_type=awaak

      Response: {

        "success": true,

        "bill_number": "A2025A002"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[14] GET /api/transactions/bill-number-info

      ��% Batch/sequence info for bill numbering

      Params: bill_type=awaak&year=2025

      Response: {

        "success": true,

        "bill_type": "awaak",

        "year": 2025,

        "current_batch": "A",

        "current_number": 2,

        "remaining": 498

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[15] GET /api/transactions/{transaction_id}

      ��% Get single transaction by ID with items & payments

      Response: {

        "success": true,

        "data": {

                "id": "t-111aaa",

                "bill_number": "A2025A001"

        }

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[16] POST /api/transactions

      ��% Create a new Awaak or Jawaak transaction

      Body: {

        "bill_type": "awaak",

        "bill_date": "2025-03-15",

        "party_id": "p-abc123",

        "lot_number": "LOT001",

        "items": [

                {

                        "mirchi_...

      Response: {

        "success": true,

        "message": "Transaction created successfully",

        "data": {

                "id": "t-111aaa",

                "bill_number": "A2025A001",

                "total_amount": 15200.0

        }

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[17] POST /api/transactions/{transaction_id}/payment

      ��% Add payment to a transaction

      Params: amount=5000

      Response: {

        "success": true,

        "message": "Payment updated successfully"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[18] POST /api/transactions/{transaction_id}/revert

      ��% Revert a transaction (creates return bill, reverses stock)

      Response: {

        "success": true,

        "message": "Transaction reverted successfully"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[19] DELETE /api/transactions/{transaction_id}

      ��% Delete a transaction

      Response: {

        "success": true,

        "message": "Transaction deleted successfully"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[20] GET /api/patti-transactions

      ��% List all patti transactions

      Params: bill_type(patti_awaak|patti_jawaak), party_id, search, start_date, end_date, skip, limit

      Response: {

        "success": true,

        "data": [

                {

                        "id": "pt-222bbb",

                        "bill_number": "PA2025A001",

                        "bill_type": "patti_awaak",

                        "party_name": "�����������b% �����[%���������%",

                        "lot_number":...

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[21] GET /api/patti-transactions/lots/available/{mirchi_id}

      ��% Get available patti lots for Jawaak billing (with weight/bag info)

      Response: {

        "success": true,

        "data": [

                {

                        "id": "patti-lot-PLOT001",

                        "lot_number": "PLOT001",

                        "mirchi_name": "���%��[%���% �����%���%������",

                        "gross_weight": 1000.0,

                        "remaining_qu...

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[22] GET /api/patti-transactions/next-bill-number

      ��% Get next patti bill number

      Params: bill_type=patti_awaak

      Response: {

        "success": true,

        "bill_number": "PA2025A001"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[23] POST /api/patti-transactions

      ��% Create a patti_awaak or patti_jawaak transaction

      Body: {

        "bill_type": "patti_awaak",

        "bill_date": "2025-03-15",

        "party_id": "p-abc123",

        "lot_number": "PLOT001",

        "gross_weight": 1000.0,

        "verified_net_weight":...

      Response: {

        "success": true,

        "message": "Patti transaction created successfully",

        "data": {

                "id": "pt-222bbb",

                "bill_number": "PA2025A001"

        }

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[24] POST /api/patti-transactions/{transaction_id}/payment

      ��% Add payment to patti transaction

      Params: amount=10000

      Response: {

        "success": true,

        "message": "Payment updated successfully"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[25] POST /api/patti-transactions/{transaction_id}/revert

      ��% Revert patti transaction (reverses stock from patti holdings)

      Response: {

        "success": true,

        "message": "Patti transaction reverted successfully"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[26] DELETE /api/patti-transactions/{transaction_id}

      ��% Delete a patti transaction

      Response: {

        "success": true,

        "message": "Patti transaction deleted successfully"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[27] GET /api/stock-ledger

      ��% List all stock movement entries

      Params: mirchi_name, movement_type(IN|OUT|RETURN_IN|RETURN_OUT), lot_number, start_date, end_date, skip, limit

      Response: {

        "success": true,

        "data": [

                {

                        "id": "sl-333ccc",

                        "mirchi_name": "���%��[%���% �����%���%������",

                        "movement_type": "IN",

                        "quantity_in": 500.0,

                        "quantity_out": 0.0,

    ...

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[28] GET /api/stock-ledger/summary

      ��% Summary of current stock by mirchi type

      Response: {

        "success": true,

        "data": [

                {

                        "mirchi_name": "���%��[%���% �����%���%������",

                        "balance": 500.0,

                        "total_in": 1000.0,

                        "total_out": 500.0

                }

        ]

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[29] GET /api/stock-ledger/lots

      ��% Lot-wise stock summary (patti lot tracking)

      Params: mirchi_name (optional)

      Response: {

        "success": true,

        "data": [

                {

                        "mirchi_name": "���%��[%���% �����%���%������",

                        "lot_number": "PLOT001",

                        "balance": 480.0,

                        "total_in": 980.0,

                        "total_out": 500.0

        ...

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[30] GET /api/stock-ledger/available/{mirchi_id}

      ��% Available lots for Jawaak billing (balance > 0)

      Response: {

        "success": true,

        "data": [

                {

                        "id": "lot-PLOT001",

                        "lot_number": "PLOT001",

                        "remaining_quantity": 480.0,

                        "poti_count": 9,

                        "display": "PLOT001 | 480...

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[31] GET /api/stock-ledger/balance/{mirchi_name}

      ��% Get current balance for a specific mirchi (optionally by lot)

      Params: lot_number (optional)

      Response: {

        "success": true,

        "data": {

                "mirchi_name": "���%��[%���% �����%���%������",

                "lot_number": null,

                "current_balance": 500.0

        }

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[32] GET /api/stock-ledger/analysis

      ��% Lot-wise P&L analysis (buy qty/amt vs sell qty/amt)

      Response: {

        "success": true,

        "data": [

                {

                        "lot_number": "LOT001",

                        "mirchi_name": "���%��[%���% �����%���%������",

                        "farmer_name": "���%��[%������%��[%���% ���������%���������%�����U%",

                        "buy_qty": 500.0,

                        "buy_amt": 15...

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[33] GET /api/stock-ledger/{ledger_id}

      ��% Single stock ledger entry by ID

      Response: {

        "success": true,

        "data": {

                "id": "sl-333ccc",

                "movement_type": "IN"

        }

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[34] GET /api/party-jama

      ��% List all standalone jama (payment) entries

      Params: party_id, start_date, end_date, skip, limit

      Response: {

        "success": true,

        "data": [

                {

                        "id": "pj-444ddd",

                        "party_id": "p-abc123",

                        "date": "2025-03-14",

                        "amount": 5000.0,

                        "reference": "UPI-123",

          ...

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[35] GET /api/party-jama/party/{party_id}/balance

      ��% Party's computed balance (transactions + jama)

      Response: {

        "success": true,

        "data": {

                "party_id": "p-abc123",

                "past_due": 5000.0,

                "regular_balance": 7500.0,

                "patti_balance": 0.0,

                "jama_total": 2000.0,

                "current_balance": 10500.0

        }

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[36] GET /api/party-jama/party/{party_id}/ledger

      ��% Full chronological party ledger (bills + jama entries merged)

      Params: start_date, end_date

      Response: {

        "success": true,

        "data": {

                "party": {

                        "id": "p-abc123",

                        "name": "���%��[%������%��[%���% ���������%���������%�����U%"

                },

                "entries": [

                        {

                                "date": "2025-03-10",

        ...

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[37] POST /api/party-jama

      ��% Create a standalone jama (payment) entry

      Body: {

        "party_id": "p-abc123",

        "date": "2025-03-15",

        "amount": 5000.0,

        "reference": "UPI-456",

        "notes": "��������[%��� ���%������������"

}

      Response: {

        "success": true,

        "message": "Jama entry created successfully",

        "data": {

                "id": "pj-555eee"

        }

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[38] PUT /api/party-jama/{entry_id}

      ��% Update a jama entry

      Body: {

        "amount": 6000.0,

        "notes": "��U%��������[%���%��%��� ���%������������"

}

      Response: {

        "success": true,

        "message": "Jama entry updated successfully"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[39] DELETE /api/party-jama/{entry_id}

      ��% Delete a jama entry

      Response: {

        "success": true,

        "message": "Jama entry deleted successfully"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[40] GET /health

      ��% App health check

      Response: {

        "status": "healthy",

        "app": "Mirchi Trading API",

        "version": "1.0.0"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



[41] GET /

      ��% Root info endpoint

      Response: {

        "message": "Welcome to Mirchi Trading API",

        "version": "1.0.0",

        "docs": "/docs"

}

      ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������



======================================================================

  TOTAL ENDPOINTS: 41

======================================================================





��� Documentation complete. API docs also available at: http://localhost:8000/docs