Use cWebBusinessProcess.pkg Use DataDict.pkg Use cWebReport.pkg Use Vendor.DD Use Invt.DD Object oInvt is a cWebBusinessProcess // private. Determines if Invt is constrained to Vendor. // This is set with ConstrainVendor Property Integer pbConstrained False Set pbClearAfterSave to False Set psDescription to "Inventory; Entry, report and Maintenance" Object Vendor_DD is a Vendor_DataDictionary Send DefineAllExtendedFields End_Object // Vendor_DD Object Invt_DD is a Invt_DataDictionary Set DDO_Server to Vendor_DD Send DefineAllExtendedFields End_Object // Invt_DD Set Main_DD to Invt_DD Object oReport is a cWebReport Property String psVendorHRef Procedure OnPageTop Send WriteHtmlTableBegin 'border="0" width="99%" Class="ReportTable"' Send WriteHtmlRowBegin Send WriteHtmlCellHeader 'Item ID' 'Class="Header" Align="left"' Send WriteHtmlCellHeader 'Description' 'Class="Header" Align="left"' Send WriteHtmlCellHeader 'Vndr ID' 'Class="Header" Align="right"' Send WriteHtmlCellHeader 'Name' 'Class="Header" Align="left"' Send WriteHtmlCellHeader 'Vendor Part ID' 'Class="Header" Align="left"' Send WriteHtmlCellHeader 'Unit Price' 'Class="Header" Align="right"' Send WriteHtmlCellHeader 'On Hand' 'Class="Header" Align="right"' Send WriteHtmlRowEnd End_Procedure // OnPageTop Procedure OnBody String sText sVLink sURL Number nVendorId nUnitPrice nOnHand String sVendorName sDescription sPartId sItemId Get ddValueEncode "Vendor.ID" to nVendorID Get ddValueEncode "Vendor.Name" to sVendorName Get ddValueEncode "Invt.Item_ID" to sItemID Get ddValueEncode "Invt.Description" to sDescription Get ddValueEncode "Invt.Vendor_Part_ID" to sPartID Get ddValueEncode "Invt.Unit_Price" to nUnitPrice Get ddValueEncode "Invt.On_Hand" to nOnHand Send WriteHtmlRowBegin Get AddRowIdLink sItemId to sText Send WriteHtmlCell sText 'Class="Data" Align="left"' Send WriteHtmlCell sDescription 'Class="Data" Align="left"' // third cell will provide a link to the Vendor ASP file. // Use the VendorName for the URL and pass VendorRowId="xxx" // as the query string Get psVendorHRef to sVLink Move (sVLink - "?RowId="- SerializeRowId(GetRowId(Vendor.File_Number))) to sUrl Get HtmlLink sUrl (FormatNumber(nVendorID,0)) to sText Send WriteHtmlCell sText 'Class="Data" Align="right"' Send WriteHtmlCell sVendorName 'Class="Data" Align="left"' Send WriteHtmlCell sPartID 'Class="Data" Align="left"' Send WriteHtmlCell (FormatNumber(nUnitPrice,2)) 'Class="Data" Align="right"' Send WriteHtmlCell (FormatNumber(nOnHand,0)) 'Class="Data" Align="right"' Send WriteHtmlRowEnd End_Procedure // OnBody Procedure OnPageBottom Send WriteHtmlTableEnd End_Procedure // OnPageBottom Function RunInvtList integer iIndex RowId riStart integer iMax Returns RowId RowId riEnd Integer iStat Set piOrdering to iIndex Set piMaxCount to iMax Set piMaxCountBreakLevel to 0 Set priStartRowId to riStart Get DoRunReport to iStat Get priLastRowId to riEnd Function_return riEnd End_Function // RunInvtList End_Object // oReport { Published = True } { Description = "" } Procedure SetHRefName String sName Set psHRefname Of oReport To sName End_Procedure // SetHRefName { Published = True } { Description = "" } Procedure SetVendorHRefName String sName Set psVendorHRef Of oReport To sName End_Procedure // Public: can be used to determine if INVT should be constrained to Vendor // Remember that this DDO is used for data entry and reports. So if // you set a constraint for the report you might want to remember to // clear it when you are done { Published = True } { Description = "" } Procedure ConstrainVendor Integer bState Integer iFile If bState Move Vendor.File_Number To iFile Else Move 0 To iFile Set Constrain_File Of Invt_DD To iFile Send Rebuild_Constraints Of Invt_DD Set pbConstrained To bState End_Procedure { Published = True } { Description = "" } Function RunInvtList Integer iIndex string Start Integer iMax Returns string RowId riEnd Integer bOld // make sure constraints are off - we want all Get pbConstrained To bOld Send ConstrainVendor False Get RunInvtList Of oReport iIndex (DeSerializeRowId(Start)) iMax To riEnd // restore contraints Send ConstrainVendor bOld Function_Return (SerializeRowId(riEnd)) End_Function // RunInvtList // Run report for all Invt items for passed vendor. // Pass: VendorRowId,ASP name of Invt and Vendor URLs // // Called from ASP: bpo.dffunc "msg_RunInvtReport" Index "Invt.asp" "Vendor.asp" { Published = True } { Description = "" } Procedure RunVndrInvtList String sVndr Integer bFound Integer bOld Integer iIndex RowId riEnd riStart String sName sPhone sId // find the passed Vendor rowid Get ddFindbyRowId "Vendor" sVndr To bFound If Not (bFound) Procedure_Return // no vendor...error Move 2 To iIndex // index is always 2 - by vendor id // turn on relates to contraints for report Get pbConstrained To bOld Send ConstrainVendor True // generate a header with current vendor to be printed Get ddValueEncode "Vendor.ID" To sID Get ddValueEncode "Vendor.Name" To sName Get ddValueEncode "Vendor.Phone_Number" To sPhone Send WriteHtml ("
" + sID + " - " + ; sName+"  " + ; sPhone+"
") Send Find of Invt_DD GE 2 If not (Found); Send WriteHtml ("
No Inventory Items found for this Vendor
") Else; Get RunInvtList Of oReport iIndex (nullrowid()) 0 To riEnd // restore old constraints Send ConstrainVendor bOld End_Procedure // Register WBO interfaces Send RegisterStandardInterface // Send RegisterDebugInterface // Send RegisterFullErrorInterface // Send RegisterAutoEntryInterface End_Object // oInvt