DELETE FROM Report WHERE Name='Reorder Report' DELETE FROM Report WHERE Name='Inventory Complete' DELETE FROM Report WHERE Name='Inventory by Store' DELETE FROM Report WHERE Name='Work Order List' DELETE FROM Report WHERE Name='Work Order by Date' DELETE FROM Report WHERE Name='Work Order by Date Range' DELETE FROM Report WHERE Name='Goods Receivable List' DELETE FROM Report WHERE Name='Goods Receivable by Date' DELETE FROM Report WHERE Name='Goods Receivable by Date Range' INSERT INTO Report (RecId, IsActive, Name, Filepath, Sql) VALUES (, 'true', 'Reorder Report', 'Reports\ReorderReport.csv', 'SELECT Storeroom.Name, Item.Code, Item.name, Item.Quantity, Item.MinStock, Item.MaxStock, Item.Value, ROUND(Item.Quantity * Item.Value, 2) AS Total, CASE WHEN (Item.Quantity < abs(Item.MinStock)) THEN (Item.MaxStock - Item.Quantity) ELSE 0 END AS OrderQty FROM Item, Storeroom WHERE Storeroom.RecId=Item.StoreroomRef AND OrderQty > 0') INSERT INTO Report (RecId, IsActive, Name, Filepath, Sql) VALUES (, 'true', 'Inventory Complete', 'Reports\InventoryComplete.csv', 'SELECT Storeroom.Name, Item.Code, Item.name, Item.Quantity, Item.Value, ROUND(Item.Quantity * Item.Value, 2) AS Total FROM Item, Storeroom WHERE Storeroom.RecId=Item.StoreroomRef') INSERT INTO Report (RecId, IsActive, Name, Filepath, Sql) VALUES (, 'true', 'Inventory by Store', 'Reports\InventoryByStore.csv', 'SELECT Storeroom.Name, Item.Code, Item.name, Item.Quantity, Item.Value, ROUND(Item.Quantity * Item.Value, 2) AS Total FROM Item, Storeroom WHERE Storeroom.RecId=Item.StoreroomRef AND UPPER(Storeroom.Code) = UPPER(''PbsGetInput("Text1","Storeroom","")'')') INSERT INTO Report (RecId, IsActive, Name, Filepath, Sql) VALUES (, 'true', 'Work Order List', 'Reports\WorkOrderList.csv', 'SELECT Requisition.Number, Requisition.Date, Item.Code, Item.Name, RequisitionLine.Quantity, Storeroom.Name, Item.Value, ROUND(RequisitionLine.Quantity * Item.Value, 2) AS Total FROM RequisitionLine, Requisition, Storeroom, Item WHERE Requisition.RecId=RequisitionLine.RequisitionRef AND Storeroom.RecId=Requisition.StoreroomRef AND Item.RecId=RequisitionLine.ItemRef') INSERT INTO Report (RecId, IsActive, Name, Filepath, Sql) VALUES (, 'true', 'Work Order by Date', 'Reports\WorkOrderByDate.csv', 'SELECT Requisition.Number, Requisition.Date, Item.Code, Item.Name, RequisitionLine.Quantity, Storeroom.Name, Item.Value, ROUND(RequisitionLine.Quantity * Item.Value, 2) AS Total FROM RequisitionLine, Requisition, Storeroom, Item WHERE Requisition.RecId=RequisitionLine.RequisitionRef AND Storeroom.RecId=Requisition.StoreroomRef AND Item.RecId=RequisitionLine.ItemRef AND Requisition.Date LIKE ''PbsGetInput("Date1","Enter Date","")%''') INSERT INTO Report (RecId, IsActive, Name, Filepath, Sql) VALUES (, 'true', 'Work Order by Date Range', 'Reports\WorkOrderByDateRange.csv', 'SELECT Requisition.Number, Requisition.Date, Item.Code, Item.Name, RequisitionLine.Quantity, Storeroom.Name, Item.Value, ROUND(RequisitionLine.Quantity * Item.Value, 2) AS Total FROM RequisitionLine, Requisition, Storeroom, Item WHERE Requisition.RecId=RequisitionLine.RequisitionRef AND Storeroom.RecId=Requisition.StoreroomRef AND Item.RecId=RequisitionLine.ItemRef AND Requisition.Date >= ''PbsGetInput("Date1","Start Date","")'' AND Requisition.Date <= ''PbsGetInput("Date2","End Date","")%''') INSERT INTO Report (RecId, IsActive, Name, Filepath, Sql) VALUES (, 'true', 'Goods Receivable List', 'Reports\GoodsReceivableList.csv', 'SELECT Bill.Number, Bill.PONumber, Bill.InvoiceNumber, Bill.Date, Item.Code, Item.Name, BillLine.Quantity, Storeroom.Name, Item.Value, ROUND(BillLine.Quantity * Item.Value, 2) AS Total FROM BillLine, Bill, Storeroom, Item WHERE Bill.RecId=BillLine.BillRef AND Storeroom.RecId=Bill.StoreroomRef AND Item.RecId=BillLine.ItemRef') INSERT INTO Report (RecId, IsActive, Name, Filepath, Sql) VALUES (, 'true', 'Goods Receivable by Date', 'Reports\GoodsReceivableByDate.csv', 'SELECT Bill.Number, Bill.PONumber, Bill.InvoiceNumber, Bill.Date, Item.Code, Item.Name, BillLine.Quantity, Storeroom.Name, Item.Value, ROUND(BillLine.Quantity * Item.Value, 2) AS Total FROM BillLine, Bill, Storeroom, Item WHERE Bill.RecId=BillLine.BillRef AND Storeroom.RecId=Bill.StoreroomRef AND Item.RecId=BillLine.ItemRef AND Bill.Date LIKE ''PbsGetInput("Date1","Enter Date","")%''') INSERT INTO Report (RecId, IsActive, Name, Filepath, Sql) VALUES (, 'true', 'Goods Receivable by Date Range', 'Reports\GoodsReceivableByDateRange.csv', 'SELECT Bill.Number, Bill.PONumber, Bill.InvoiceNumber, Bill.Date, Item.Code, Item.Name, BillLine.Quantity, Storeroom.Name, Item.Value, ROUND(BillLine.Quantity * Item.Value, 2) AS Total FROM BillLine, Bill, Storeroom, Item WHERE Bill.RecId=BillLine.BillRef AND Storeroom.RecId=Bill.StoreroomRef AND Item.RecId=BillLine.ItemRef AND Bill.Date >= ''PbsGetInput("Date1","Start Date","")'' AND Bill.Date <= ''PbsGetInput("Date2","End Date","")%''')