Item Summary


var ItemDescString = "" // string to build warehouse href for table var TotalOnHand = 0 // on hand for all warehouses var TotalOnOrder = 0 // on order for all warehouses var TotalAllocated = 0 // allocated for all warehouses // prevent any db conflicts project.lock() // one update, one insert - make sure both are done database.beginTransaction() // get parts row PartCursor = database.cursor("select * from parts where part_no = '" + request.PartNumber + "'") // invalid part if (!PartCursor.next()) { project.unlock() redirect ("../user/error.htm?ErrorPart=" + request.PartNumber + "&ErrorWhouse=N/A&ErrorType=badpart") } write ("

") write ("" + "" + "" + "" + "") write ("" + "" + "" + "" + "") write ("
Part Summary") write ("
Part numberDescriptionUnit of Measure
" + PartCursor.part_no + "" + PartCursor.description + "" + PartCursor.uom + "

") // PartCursor.close() // no longer used, free it // get cursor on warehouse table WareCursor = database.cursor("select * from warehouse where part_no = '" + request.PartNumber + "' order by warehouse_id") write ("

") write ("" + "" + "" + "" + "" + "" + "") while (WareCursor.next()) { // HistCursor = database.cursor("select * from history where part_no = '" + request.PartNumber + "' AND warehouse_id = '" + WareCursor.warehouse_id + "' order by date_time DESC") HistCursor = database.cursor("select part_no, warehouse_id, date_time from history where part_no = '" + request.PartNumber + "' AND warehouse_id = '" + WareCursor.warehouse_id + "' order by date_time DESC") HistCursor.next() // error would be absence of last trx date TotalOnHand += parseInt(WareCursor.qty_on_hand,10) TotalAllocated += parseInt(WareCursor.qty_allocated,10) TotalOnOrder += parseInt(WareCursor.qty_on_order,10) WareRefString = '' write ("" + "" + "" + "" + "" + "" + "") HistCursor.close() // free for next iteration } // end while write ("" + "" + "" + "" + "" + "" + "") write ("
Warehouse Summary") write ("
WarehouseQuantity on-handQuantity allocatedQuantity on-orderLast transaction date
" + WareRefString + WareCursor.warehouse_id + "" + WareCursor.qty_on_hand + "" + WareCursor.qty_allocated + "" + WareCursor.qty_on_order + "" + HistCursor.date_time + "
Totals" + TotalOnHand + "" + TotalAllocated + "" + TotalOnOrder + "" + " " + "

")