2026-03-23 17:19:21 +05:30
|
|
|
from model.ItemCRUD import ItemCRUD
|
|
|
|
|
from model.Utilities import ItemCRUDType
|
2026-03-23 11:37:15 +05:30
|
|
|
|
|
|
|
|
class GST:
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
def get_unreleased_gst():
|
2026-03-23 17:19:21 +05:30
|
|
|
# Use ItemCRUD for Invoices
|
|
|
|
|
invoice_crud = ItemCRUD(itemType=ItemCRUDType.Invoice)
|
|
|
|
|
invoices_rows = invoice_crud.GetAllData(storedproc="GetAllInvoicesBasic")
|
|
|
|
|
|
|
|
|
|
if not invoice_crud.isSuccess:
|
2026-04-03 12:10:47 +05:30
|
|
|
return [] # Could also log invoice_crud.resultMessage
|
2026-03-23 17:19:21 +05:30
|
|
|
|
|
|
|
|
invoices = [
|
|
|
|
|
dict(
|
|
|
|
|
Invoice_No=row[1],
|
|
|
|
|
GST_SD_Amount=float(row[2]) if row[2] is not None else 0
|
|
|
|
|
)
|
|
|
|
|
for row in invoices_rows
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
# Use ItemCRUD for GST Releases
|
|
|
|
|
gst_crud = ItemCRUD(itemType=ItemCRUDType.GSTRelease)
|
|
|
|
|
gst_rows = gst_crud.GetAllData(storedproc="GetAllGSTReleasesBasic")
|
|
|
|
|
|
|
|
|
|
if not gst_crud.isSuccess:
|
2026-04-03 12:10:47 +05:30
|
|
|
return [] # Could also log gst_crud.resultMessage
|
2026-03-23 17:19:21 +05:30
|
|
|
|
|
|
|
|
gst_invoice_nos = {
|
2026-04-03 12:10:47 +05:30
|
|
|
g[2] # Invoice_No is at index 2
|
2026-03-23 17:19:21 +05:30
|
|
|
for g in gst_rows
|
|
|
|
|
if g[2]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gst_basic_amounts = {
|
2026-04-03 12:10:47 +05:30
|
|
|
float(g[3]) # Basic_Amount at index 3
|
2026-03-23 17:19:21 +05:30
|
|
|
for g in gst_rows
|
|
|
|
|
if g[3] is not None
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Filter unreleased invoices
|
|
|
|
|
unreleased = []
|
|
|
|
|
for inv in invoices:
|
|
|
|
|
match_by_invoice = inv['Invoice_No'] in gst_invoice_nos
|
|
|
|
|
match_by_gst_amount = inv['GST_SD_Amount'] in gst_basic_amounts
|
|
|
|
|
|
|
|
|
|
if not (match_by_invoice or match_by_gst_amount):
|
|
|
|
|
unreleased.append(inv)
|
|
|
|
|
|
|
|
|
|
return unreleased
|