Subversion Repositories SmartDukaan

Rev

Rev 23770 | Rev 25270 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23770 Rev 23771
Line 71... Line 71...
71
        unitPrice, sgstRate, cgstRate, igstRate, SUM(initialQuantity) AS quantity, 1000 * UNIX_TIMESTAMP(receivedOn) as purchasedAt, p.id as purchaseId, 
71
        unitPrice, sgstRate, cgstRate, igstRate, SUM(initialQuantity) AS quantity, 1000 * UNIX_TIMESTAMP(receivedOn) as purchasedAt, p.id as purchaseId, 
72
        nlc, po.warehouseId, po.taxType, 1000 * UNIX_TIMESTAMP(inv.invoiceDate) as invoiceDate, p.purchaseComments 
72
        nlc, po.warehouseId, po.taxType, 1000 * UNIX_TIMESTAMP(inv.invoiceDate) as invoiceDate, p.purchaseComments 
73
    FROM purchaseorder po
73
    FROM purchaseorder po
74
    JOIN purchase p 
74
    JOIN purchase p 
75
        ON (po.id = p.purchaseOrder_id)
75
        ON (po.id = p.purchaseOrder_id)
76
    JOIN (select * from invoice limit 1) inv
76
    JOIN (select * from invoice group by invoiceNumber, supplierId) inv
77
    	ON (inv.invoiceNumber = p.invoiceNumber AND inv.supplierId = po.supplierId)
77
    	ON (inv.invoiceNumber = p.invoiceNumber AND inv.supplierId = po.supplierId)
78
    JOIN inventoryItem i
78
    JOIN inventoryItem i
79
        ON (p.id = i.purchaseId)
79
        ON (p.id = i.purchaseId)
80
    JOIN lineitem l
80
    JOIN lineitem l
81
        ON (l.itemId = i.itemId AND l.purchaseOrder_id = po.id)
81
        ON (l.itemId = i.itemId AND l.purchaseOrder_id = po.id)