PageRenderTime 28ms CodeModel.GetById 22ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/beta/reports/inv_cost.asp

http://github.com/khaneh/Orders
ASP | 19 lines | 12 code | 6 blank | 1 comment | 0 complexity | e77c00a82044c663e1f4ae9a6c1917d6 MD5 | raw file
 1<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%><%
 2'Response.Buffer=false
 3Response.CodePage = 65001
 4Response.CharSet = "utf-8"
 5reportTitle = "گزارش ريالي انبار"
 6%>
 7<!--#include File="reports_top.asp"-->
 8<%
 9
10	dateFrom = request("dateFrom")
11	dateTo = request("dateTo")
12
13	mySQL = "SELECT InventoryItemCategories.Name AS [دسته بندي], InventoryItems.OldItemID AS [کد کالا], InventoryItems.Name AS [نام کالا], DRV_sumBefore.sumQtty AS [موجودي اول دوره], DRV_sumGardesh.sumInput AS [ورود عادي], DRV_azTolid.sumInput AS [ورود از توليد], DRV_Marjoee.sumInput AS [ورود مرجوعي], DRV_azAnbarDigar.sumInput AS [ورود از انبار ديگر], DRV_Enteghal.sumInput AS [ورود انتقال], DRV_sumGardesh.sumOutput AS [خروجي عادي], DRV_Enteghal.sumOutput AS [خروج انتقال], DRV_sumAfter.sumQtty AS [موجودي پايان دوره], DRV_sumPurchase.sumQtty AS [جمع خريد], DRV_sumPurchase.sumPrice AS [قيمت خريد], ROUND(DRV_sumPurchase.sumPrice / DRV_sumPurchase.sumQtty, 2) AS [قيمت واحد خريد]FROM (SELECT ItemID, SUM(IsInput * Qtty) AS sumInput, SUM((1 - IsInput) * Qtty) AS sumOutput FROM InventoryLog WHERE (Voided = 0) AND (owner = - 1) AND (logDate >= N'" & dateFrom & "') AND (logDate <= N'" & dateTo & "') AND (type = 5)  GROUP BY ItemID) DRV_Enteghal RIGHT OUTER JOIN (SELECT ItemID, SUM(IsInput * Qtty) AS sumInput, SUM((1 - IsInput) * Qtty) AS sumOutput FROM InventoryLog WHERE (Voided = 0) AND (owner = - 1) AND (logDate >= N'" & dateFrom & "') AND (logDate <= N'" & dateTo & "') AND (type = 7) GROUP BY ItemID) DRV_azAnbarDigar RIGHT OUTER JOIN InventoryItemCategoryRelations INNER JOIN InventoryItemCategories ON InventoryItemCategoryRelations.Cat_ID = InventoryItemCategories.ID INNER JOIN InventoryItems ON InventoryItemCategoryRelations.Item_ID = InventoryItems.ID ON DRV_azAnbarDigar.ItemID = InventoryItems.ID LEFT OUTER JOIN (SELECT ItemID, SUM(IsInput * Qtty) AS sumInput, SUM((1 - IsInput) * Qtty) AS sumOutput FROM InventoryLog WHERE (Voided = 0) AND (owner = - 1) AND (logDate >= N'" & dateFrom & "') AND (logDate <= N'" & dateTo & "') AND (type = 3) GROUP BY ItemID) DRV_Marjoee ON InventoryItems.ID = DRV_Marjoee.ItemID LEFT OUTER JOIN (SELECT ItemID, SUM(IsInput * Qtty) AS sumInput, SUM((1 - IsInput) * Qtty) AS sumOutput FROM InventoryLog WHERE (Voided = 0) AND (owner = - 1) AND (logDate >= N'" & dateFrom & "') AND (logDate <= N'" & dateTo & "') AND (type = 6) GROUP BY ItemID) DRV_azTolid ON InventoryItems.ID = DRV_azTolid.ItemID ON DRV_Enteghal.ItemID = InventoryItems.ID LEFT OUTER JOIN (SELECT SUM(dbo.VoucherLines.qtty) AS sumQtty, SUM(dbo.VoucherLines.price) AS sumPrice, dbo.PurchaseOrders.TypeID FROM dbo.Vouchers INNER JOIN dbo.VoucherLines ON dbo.Vouchers.id = dbo.VoucherLines.Voucher_ID INNER JOIN dbo.PurchaseOrders ON dbo.VoucherLines.RelatedPurchaseOrderID = dbo.PurchaseOrders.ID WHERE (dbo.PurchaseOrders.IsService = 0) AND (dbo.Vouchers.Voided = 0) AND (dbo.Vouchers.EffectiveDate > N'" & dateFrom & "') AND (dbo.Vouchers.EffectiveDate < N'" & dateTo & "') GROUP BY dbo.PurchaseOrders.TypeID) DRV_sumPurchase ON InventoryItems.ID = DRV_sumPurchase.TypeID LEFT OUTER JOIN (SELECT ItemID, SUM(IsInput * Qtty) AS sumInput, SUM((1 - IsInput) * Qtty) AS sumOutput FROM InventoryLog WHERE (Voided = 0) AND (owner = - 1) AND (logDate >= N'" & dateFrom & "') AND (logDate <= N'" & dateTo & "') AND (type <> 3) AND (type <> 5) AND (type <> 6) AND (type <> 7) GROUP BY ItemID) DRV_sumGardesh ON InventoryItems.ID = DRV_sumGardesh.ItemID LEFT OUTER JOIN (SELECT ItemID, SUM(IsInput * Qtty) - SUM((1 - IsInput) * Qtty) AS sumQtty FROM dbo.InventoryLog WHERE (Voided = 0) AND (owner = - 1) AND (logDate <= N'"  & dateTo & "') GROUP BY ItemID) DRV_sumAfter ON InventoryItems.ID = DRV_sumAfter.ItemID LEFT OUTER JOIN (SELECT ItemID, SUM(IsInput * Qtty) - SUM((1 - IsInput) * Qtty) AS sumQtty FROM dbo.InventoryLog WHERE (Voided = 0) AND (owner = - 1) AND (logDate <= N'"  & dateFrom & "') GROUP BY ItemID) DRV_sumBefore ON InventoryItems.ID = DRV_sumBefore.ItemID ORDER BY InventoryItemCategories.ID, InventoryItems.OldItemID "
14	
15%>
16<!--#include File="reports_tah.asp"-->
17
18
19