- def get_data(conditions, filters):
- data = frappe.db.sql(
- f"""
- SELECT
- so.transaction_date as date,
- soi.delivery_date as delivery_date,
- so.name as sales_order,
- so.status, so.customer, soi.item_code,
- DATEDIFF(CURRENT_DATE, soi.delivery_date) as delay_days,
- IF(so.status in ('Completed','To Bill'), 0, (SELECT delay_days)) as delay,
- soi.qty, soi.delivered_qty,
- (soi.qty - soi.delivered_qty) AS pending_qty,
- IFNULL(SUM(sii.qty), 0) as billed_qty,
- soi.base_amount as amount,
- (soi.delivered_qty * soi.base_rate) as delivered_qty_amount,
- (soi.billed_amt * IFNULL(so.conversion_rate, 1)) as billed_amount,
- (soi.base_amount - (soi.billed_amt * IFNULL(so.conversion_rate, 1))) as pending_amount,
- soi.warehouse as warehouse,
- so.company, soi.name,
- soi.description as description
This file has been truncated. show original