I got this sales report that gives me percent sales , i get the percent sales per item lookuip code correct , but on the scale of item class code it does not give correct percentages !!
Anybody have an idea about where the problem could be ?
//--- Report Summary --- //
Begin ReportSummary
ReportType = reporttypeItems
ReportTitle = "نسبه المبيعات"
PageOrientation = pageorientationLandscape
WordWrap = False
ShowDateTimePicker = False
OutLineMode = True
Groups = 1
GroupDescription = ""
DisplayLogo = True
LogoFileName = "MyLogo.bmp"
ProcedureCall = ""
PreQuery1 = "IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'ViewItemMovement') DROP VIEW ViewItemMovement"
PreQuery2 = <BEGIN>
CREATE VIEW ViewItemMovement AS
SELECT PurchaseOrder.ID, ItemClass.ItemLookupCode AS MotherCode, Item.ItemLookupCode, Item.Cost, Item.Description, ItemClassComponent.Detail1, ItemClassComponent.Detail2,
ItemClassComponent.Detail3, Item.SubDescription1, Item.SubDescription2, Item.SubDescription3, Department.Name AS DepartmentName, Category.Name as Category, Supplier.SupplierName,
PurchaseOrderEntry.QuantityReceivedToDate AS QtyPurchase,
(SELECT SUM(Quantity) AS Expr1
FROM TransactionEntry
WHERE (Item.ID = ItemID)) AS QtySales, CAST
((SELECT SUM(Quantity) AS Expr1
FROM TransactionEntry AS TransactionEntry_2
WHERE (Item.ID = ItemID)) / PurchaseOrderEntry.QuantityReceivedToDate * 100 AS Integer) AS [Percent %], ItemClass.Notes
FROM Category INNER JOIN
Item ON Category.ID = Item.CategoryID RIGHT OUTER JOIN
PurchaseOrder INNER JOIN
PurchaseOrderEntry ON PurchaseOrder.ID = PurchaseOrderEntry.PurchaseOrderID AND PurchaseOrder.StoreID = PurchaseOrderEntry.StoreID ON
Item.ID = PurchaseOrderEntry.ItemID LEFT OUTER JOIN
ItemClassComponent ON PurchaseOrderEntry.ItemID = ItemClassComponent.ItemID LEFT OUTER JOIN
ItemClass ON ItemClassComponent.ItemClassID = ItemClass.ID LEFT OUTER JOIN
TransactionEntry AS TransactionEntry_1 ON TransactionEntry_1.ItemID = Item.ID AND PurchaseOrderEntry.StoreID = TransactionEntry_1.StoreID LEFT OUTER JOIN
Supplier ON Item.SupplierID = Supplier.ID LEFT OUTER JOIN
Department ON Item.DepartmentID = Department.ID LEFT OUTER JOIN
Store ON PurchaseOrder.StoreID = Store.ID
WHERE (PurchaseOrder.POType = 0) OR
(PurchaseOrder.POType = 1)
<END>
TablesQueried = "FROM ViewItemMovement"
SelCriteria = ""
GroupBy = ""
SortOrder = "[Percent %]"
End ReportSummary
//--- Title Rows ---//
Begin TitleRow
Text = "<Store Name>"
Font = "Arial"
FontBold = True
FontSize = 16
Color = "Blue"
End TitleRow
Begin TitleRow
Text = "<Report Title>"
Font = "Arial"
FontBold = True
FontSize = 12
Color = "Black"
End TitleRow
Begin TitleRow
Text = "Generated On <Report Date>"
Font = "Arial"
FontBold = True
FontSize = 10
Color = "Black"
End TitleRow
//--- Filters ---//
//--- Columns ---//
Begin Column
FieldName = "ViewItemMovement.DepartmentName"
DrillDownFieldName = ""
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "Department"
VBDataType = vbString
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 2976
GroupMethod = groupmethodNone
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.Category"
DrillDownFieldName = ""
DrillDownReportName = ""
Title = "Cat. Name"
VBDataType = vbString
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 2820
GroupMethod = groupmethodNone
ColFormat = ""
End Column
Begin Column
FieldName = "ViewItemMovement.QtyPurchase"
DrillDownFieldName = ""
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "QtyPurchase"
VBDataType = vbDouble
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1356
GroupMethod = groupmethodSum
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.cost"
DrillDownFieldName = ""
DrillDownReportName = ""
Title = "Item Cost"
VBDataType = vbCurrency
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1600
GroupMethod = groupmethodSum
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.cost * ViewItemMovement.QtyPurchase"
DrillDownFieldName = ""
DrillDownReportName = ""
Title = "Total P.Cost"
VBDataType = vbCurrency
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1600
GroupMethod = groupmethodSum
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.QtySales"
DrillDownFieldName = ""
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "QtySales"
VBDataType = vbDouble
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1356
GroupMethod = groupmethodSum
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.cost * ViewItemMovement.QtySales"
DrillDownFieldName = ""
DrillDownReportName = ""
Title = "Total Sales Cost"
VBDataType = vbCurrency
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1600
GroupMethod = groupmethodSum
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.[Percent %]"
DrillDownFieldName = ""
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "% Sales"
VBDataType = vbString
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1356
GroupMethod = groupmethodAverage
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.MotherCode"
DrillDownFieldName = "ItemClass.ItemLookupCode"
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "Mother Code"
VBDataType = vbString
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1200
GroupMethod = groupmethodNone
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.ItemLookupCode"
DrillDownFieldName = "Item.ItemLookupCode"
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "Item Code"
VBDataType = vbString
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1548
GroupMethod = groupmethodNone
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.Description"
DrillDownFieldName = ""
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "Description"
VBDataType = vbString
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1296
GroupMethod = groupmethodNone
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.Detail1"
DrillDownFieldName = ""
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "Color"
VBDataType = vbString
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1104
GroupMethod = groupmethodNone
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.Detail2"
DrillDownFieldName = ""
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "Size"
VBDataType = vbString
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1104
GroupMethod = groupmethodNone
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.SupplierName"
DrillDownFieldName = ""
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "Supplier"
VBDataType = vbString
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1356
GroupMethod = groupmethodNone
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.Detail3"
DrillDownFieldName = ""
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "Shipment"
VBDataType = vbString
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1104
GroupMethod = groupmethodNone
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.ID"
DrillDownFieldName = "Store.Name"
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "Purchase ID"
VBDataType = vbLong
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1104
GroupMethod = groupmethodNone
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.SubDescription1"
DrillDownFieldName = ""
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "Material"
VBDataType = vbString
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1104
GroupMethod = groupmethodNone
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.SubDescription2"
DrillDownFieldName = ""
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "Heal size"
VBDataType = vbString
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1104
GroupMethod = groupmethodNone
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.Notes"
DrillDownFieldName = ""
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "Notes"
VBDataType = vbString
Formula = ""
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1356
GroupMethod = groupmethodNone
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
Begin Column
FieldName = "ViewItemMovement.SubDescription3"
DrillDownFieldName = ""
DrillDownReportName = ""
StoreIDFieldName = ""
Title = "SubDescription3"
VBDataType = vbString
Formula = ""
ColHidden = True
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1104
GroupMethod = groupmethodNone
ColFormat = ""
ColAlignment = flexAlignLeftCenter
End Column
*This post is locked for comments
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156