QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:cp
:TCMOD:rpd
:TFLNO:320
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfCriticalMaterials
:ICOD:D
:QURY:START
	  var.cprpd320.indt  =  get.utc(BillOfCriticalMaterials.EffectiveDate, "yes")  
	  var.cprpd320.exdt  =  get.utc(BillOfCriticalMaterials.ExpiryDate, "no")  
'  |   
'  |  Sequence number can now be filled via the Access table  	   
'  	  If Hold.PlanItem  =  BillOfCriticalMaterials.PlanItem then  
'  	   	  var.cprpd320.sern  =  var.cprpd320.sern  +  1  
'  	  else  
'  	   	  var.cprpd320.sern  =  1  
'  	  end if  	   
' Hold.PlanItem  =  BillOfCriticalMaterials.PlanItem  
'  |   
dump 320
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:cp
:TCMOD:rpd
:TFLNO:320
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfCriticalMaterials
:ICOD:S
:QURY:START
select BillOfCriticalMaterials.*
from BillOfCriticalMaterials
order by BillOfCriticalMaterials.PlanItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:cp
:TCMOD:rpd
:TFLNO:320
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfCriticalMaterials
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:D
:QURY:START
	  var.cprpd710.effd  =  get.utc(SourcingStrategies.EffectivityDate, "yes")  
	  var.cprpd710.expd  =  get.utc(SourcingStrategies.ExpiryDate, "no")  	   
dump 710
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:S
:QURY:START
select SourcingStrategies.*
from SourcingStrategies
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:com
:TFLNO:117
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartnerShipToBySoldTo
:ICOD:D
:QURY:START
	  dump 117
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:com
:TFLNO:117
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartnerShipToBySoldTo
:ICOD:S
:QURY:START
select  	  BusinessPartnerShipToBySoldTo.*
from 	  BusinessPartnerShipToBySoldTo
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:com
:TFLNO:117
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartnerShipToBySoldTo
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:D
:QURY:START
	  if Addresses.SearchKey  <>  "" then  
	   	  var.tccom130.seak  =  Ucase(Left(Addresses.SearchKey,16))  
	  else  
	   	  var.tccom130.seak  =  Ucase(Left(Addresses.Name,16))  
	  end if  
'  |  Determine default messaging method  
'  |  SITA not used  
	  var.tccom130.defa  =  10  
'target(tccom.defa.not.applicable)  
	  if Addresses.SMSNumber  <>  "" then  
	   	  var.tccom130.defa  =  5 'to.target(tccom.defa.sms)  
	  end if  
	  if Addresses.Telex  <>  "" then  
	   	  var.tccom130.defa  =  3 ' to.target(tccom.defa.telex)  
	  end if  
	  if Addresses.Fax  <>  "" then  
	   	  var.tccom130.defa  =  2' to.target(tccom.defa.fax)  
	  end if  
	  if Addresses.Email  <>  "" then  
	   	  var.tccom130.defa  =  1 ' to.target(tccom.defa.email)  
	  end if  
	  if len(trim(Addresses.Telephone))  >  0 then  
	   	  var.tccom130.defa  =  6 ' to.target(tccom.defa.phone)  
	  end if  
'  |  end determine defa  
	  dump 130  
'  
	  if len(trim(Addresses.ZipPostalCode))  >  0 then  
	   	  if var.country  <>  trim(Addresses.Country) or _  
	   	  var.zipcode  <>  trim(Addresses.ZipPostalCode) then  
	   	   	  var.country  =  trim(Addresses.Country)  
	   	   	  var.zipcode  =  trim(Addresses.ZipPostalCode)  
	   	   	  dump 136  
	   	  end if  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:S
:QURY:START
select Addresses.*
from Addresses
order by Addresses.Country, Addresses.ZipPostalCode
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:com
:TFLNO:139
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:D
:QURY:START
	  if not ISNULL(Addresses.City) then  
	   	  var.tccom139.city  =  Ucase(trim(Left(Addresses.City, 8)))  
'  	   	  if prev.city  <>  var.tccom139.city then  
	   	  if ((prev.city  <>  var.tccom139.city) or (prev.country  <>  trim(Addresses.Country)) or (prev.stateprovince  <>  trim(Addresses.StateProvince))) then  
	   	   	   	  prev.city  =  var.tccom139.city  
	   	   	   	  prev.country  =  trim(Addresses.Country)  
	   	   	   	  prev.stateprovince  =  trim(Addresses.StateProvince)  
	   	   	   	  var.tccom139.idnr  =  var.tccom139.idnr  +  1  
	   	   	   	  If Addresses.CityDescription  =  "" or IsNull(Addresses.CityDescription) then  
	   	   	   	   	  var.tccom139.dsca  =  trim(Left(Addresses.City,30))  
	   	   	   	  else  
	   	   	   	   	  var.tccom139.dsca  =  trim(Left(Addresses.CityDescription,30))  
	   	   	   	  End If  
	   	   	   	  If Addresses.SearchKey  =  "" or IsNull(Addresses.SearchKey) then  
	   	   	   	   	  var.tccom139.seak  =  Ucase(trim(Left(Addresses.City, 16)))  
	   	   	   	  else  
	   	   	   	   	  var.tccom139.seak  =  Ucase(trim(Left(Addresses.SearchKey, 16)))  
	   	   	   	  End If  	   	   
	   	   	   	   
	   	   	   	  dump 139  
	   	  end if  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:com
:TFLNO:139
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:S
:QURY:START
select Addresses.*
from Addresses
where Addresses.City  <>  ""
order by Addresses.Country, Addresses.StateProvince, Addresses.City
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:com
:TFLNO:139
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:D
:QURY:START
	  varstr.cprj  =  Items.Project  
	  varstr.item  =  Items.Item  
	  if Items.WeightUnit  =  "" then  
	   	  var.tcibd001.cwun  =  var.weight.unit  
	   	  var.weight  =  0  
	  else  
	   	  var.tcibd001.cwun  =  Items.WeightUnit  
	   	  var.weight  =  Items.Weight  
	  end if  
	  if Items.SearchKeyI  <>  "" then  
	   	  var.tcibd001.seak  =  UCase(Left(Items.SearchKeyI, 16))  
	  else  
	   	  var.tcibd001.seak  =  UCase(Left(Items.ItemDescription, 16))  
	  end if  
	   
	  if Items.SearchKeyII  <>  "" then  
	   	  var.tcibd001.seab  =  UCase(Left(Items.SearchKeyII, 16))  
	  else  
	   	  var.tcibd001.seab  =  UCase(Left(Items.Item, 16))  
	  end if  
'  |  Setting for Alternative Items  
	  var.tcibd001.repl  =  5  	   	   	   	   	  '  |  Not Applicable  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where ( AlternativeItems.Project  =  "" and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  '  |  If (varstr.cprj  =  "" and AlternativeItems.Item  =  varstr.item) then  
	   	   	   	  var.tcibd001.repl  =  10  	   	   	  '  |  Replaced  
	   	   	  '  |  End If  
	   	  endselect  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  "" and AlternativeItems.AlternativeItem  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  15  	   	   	  '  |  Substitute  
	   	  endselect  
	  else  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  varstr.cprj and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  10  	   	   	  '  |  Replaced  
	   	  endselect  
	  end if  
	   
	  '  |  In case of Lot Controlled  	   	   
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.lotcontrolled  =  Items.LotControlled  
	  else  
	   	  var.lotcontrolled  =  2  
	  end if  
	  '  |  In case of Serialized Items  
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.serialized  =  Items.Serialized  
	  else  
	   	  var.serialized  =  2  
	  end if  
	   
'  |   *  Setting variables for Item Purchase Data  
	  if Items.UnitforSupplyTime  =  "" then  
	   	  Items.UnitforSupplyTime  =  10  
	  end if  
	  if Items.ItemType  =  4 then  
	   	  var.tdipu001.retw  =  2  
	   	  var.tdipu001.cwar  =  ""  
	   	  Items.LocationControlled  =  2  
	   	  Items.OutboundMethod  =  3  
	  else  
	   	  var.tdipu001.retw  =  1  
	   	  var.tdipu001.cwar  =  Items.Warehouse  
	  end if  
	  if Items.SupplyTime  <  "0" then  
	   	  Items.SupplyTime  =  "0"  
	  end if  
'  |   *  Setting variables for Item Ordering Data  
	  if Items.OrderSystem  =  4 and Items.ItemType  <>  3 then  
	   	  var.ordersystem  =  9  
	  else  
	   	  var.ordersystem  =  Items.OrderSystem  
	  end if  
	  if (Items.OrderQuantityIncrement  <=  "0") then  
	   	  var.oqmf  =  1  
	  else  
	   	  var.oqmf  =  Items.OrderQuantityIncrement  
	  end if  
	  if (Items.MinimumOrderQuantity  <=  "0") then  
	   	  var.mioq  =  1  
	  else  
	   	  var.mioq  =  Items.MinimumOrderQuantity  
	  end if  
	  if (Items.MaximumOrderQuantity  <=  "0") then  
	   	  var.maoq  =  9999999  
	  else  
	   	  var.maoq  =  Items.MaximumOrderQuantity  
	  end if  
	  if (Items.FixedOrderQuantity  <=  "0") then  
	   	  var.fioq  =  1  
	  else  
	   	  var.fioq  =  Items.FixedOrderQuantity  
	  end if  
	  if (Items.EconomicOrderQuantity  <=  "0") then  
	   	  var.ecoq  =  1  
	  else  
	   	  var.ecoq  =  Items.EconomicOrderQuantity  
	  end if  
'  |   *  SL244255.so  
'  |   	  if (Items.ReorderPoint  <=  "0") then  
'  |   	   	  var.reop  =  var.ecoq  
'  |   	  else  
'  |   	   	  var.reop  =  Items.ReorderPoint  
'  |   	  end if  
'  |   *  SL244255.eo  
	  var.reop  =  Items.ReorderPoint  	   	   	  '  |   *  SL244255.n  
	   
'  |   *  Setting variables for Item Sales Data  
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.releasetowarehouse  =  1  
	  else  
	   	  var.releasetowarehouse  =  2  
	  end if  
	  if Items.SalesPrice  <  "0" then  
	   	  Items.SalesPrice  =  "0"  
	  end if  
	  if Items.SuggestedRetailPrice  <  "0" then  
	   	  Items.SuggestedRetailPrice  =  "0"  
	  end if  
	   
'  |   *  Setting variables for Item Production Data  
	  if Items.BackflushIfMaterial  =  0 then  
	   	  Items.BackflushIfMaterial  =  2  
	  end if  
	  if Items.BackflushMaterials  =  0 then  
	   	  Items.BackflushMaterials  =  2  
	  end if  
	  if Items.BackflushHours  =  0 then  
	   	  Items.BackflushHours  =  2  
	  end if  
	  if Items.OrderLeadTimeUnit  =  0 then  
	   	  Items.OrderLeadTimeUnit  =  5  
	  end if  
	  if Items.RoutingQuantity  <=  "0" then  
	   	  Items.RoutingQuantity  =  "1"  
	  end if  
	  if Items.BOMQuantity  <=  "0" then  
	   	  Items.BOMQuantity  =  "1"  
	  end if  
	  if Items.ScrapFactor  <  "0" then  
	   	  Items.ScrapFactor  =  "0"  
	  end if  
	  if Items.ScrapQuantity  <  "0" then  
	   	  Items.ScrapQuantity  =  "0"  
	  end if  
	  if Items.OrderLeadTime  <  "0" then  
	   	  Items.OrderLeadTime  =  "0"  
	  end if  
	   
'  |   *  Setting variables for Item Costing Data  
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.acpo  =  Items.AggregatedOperationCostComp  
	   	  var.acps  =  Items.AggregatedSurchargeCostComp  
	  else  
	   	  var.acpo  =  ""  
	   	  var.acps  =  ""  
	  end if  
	   
'  |   *  Setting variables for Item Service Data  
	  if Items.ConfigurationControlled  <>  1 then  
	   	  Items.SerializedItemGroup  =  ""  
	  end if  
	   
	  if Items.LocationControlled  =  0 then  
	   	  Items.LocationControlled  =  1  
	  end if  
'  *  SL244268.so  
'  *  Logic warehouse item data moved to separate script  	   
'  	  if Items.LocationControlled  =  1 then  
'  	   	  var.whwmd210.ialt  =  5  
'  	  else  
'  	   	  var.whwmd210.ialt  =  20  
'  	  end if  
'  *  SL244268.eo  
	  if Items.FloorStock  =  0 then  
	   	  Items.FloorStock  =  2  
	  end if  
	  if Items.OutboundMethod  =  0 then  
	   	  Items.OutboundMethod  =  2  
	  end if  
	  if Items.InventoryCarryingCosts  <  "0" then  
	   	  Items.InventoryCarryingCosts  =  "0"  
	  end if  
	  if Items.Height  <  "0" then  
	   	  Items.Height  =  "0"  
	  end if  
	  if Items.Width  <  "0" then  
	   	  Items.Width  =  "0"  
	  end if  
	  if Items.Depth  <  "0" then  
	   	  Items.Depth  =  "0"  
	  end if  
	   
	  if Items.LotPrice  =  0 then  
	   	  Items.LotPrice  =  2  
	  end if  
	   
'  |  In case of Lot  -  controlled and  /  or serialized items  
	  if Items.LotControlled  =  1 then  
	   	  if Items.LotsInInventory  =  1 then  
	   	   	  var.ltpr  =  Items.LotPrice  
	   	   	  var.lttr  =  1  
	   	   	  var.linv  =  1  
	   	   	  var.ledd  =  3  
	   	   	  var.ledr  =  3  
	   	   	  var.ledt  =  3  
	   	   	  var.lisf  =  3  
	   	   	  var.lism  =  3  
	   	  else  
	   	   	  var.ltpr  =  Items.LotPrice  
	   	   	  var.lttr  =  1  
	   	   	  var.linv  =  2  
	   	   	  var.ledd  =  1  
	   	   	  var.ledr  =  2  
	   	   	  var.ledt  =  2  
	   	   	  var.lisf  =  2  
	   	   	  var.lism  =  2  
	   	  end if  
	   	   
	  else  
	   	  var.ltpr  =  2  
	   	  var.lttr  =  2  
	   	  var.linv  =  2  
	   	  var.ledd  =  3  
	   	  var.ledr  =  3  
	   	  var.ledt  =  3  
	   	  var.lisf  =  3  
	   	  var.lism  =  3  
	  end if  
	  if Items.Serialized  =  1 then  
	   	  if Items.SerialsInInventory  =  1 then  
	   	   	  var.srpr  =  Items.SerialPrice  
	   	   	  var.srtr  =  1  
	   	   	  var.sinv  =  1  
	   	   	  var.sedd  =  3  
	   	   	  var.sedr  =  3  
	   	   	  var.sedt  =  3  
	   	   	  var.sisf  =  3  
	   	   	  var.sism  =  3  
	   	  else  
	   	   	  var.srpr  =  Items.SerialPrice  
	   	   	  var.srtr  =  1  
	   	   	  var.sinv  =  2  
	   	   	  var.sedd  =  1  
	   	   	  var.sedr  =  2  
	   	   	  var.sedt  =  2  
	   	   	  var.sisf  =  2  
	   	   	  var.sism  =  2  
	   	  end if  
	  else  
	   	  var.srpr  =  2  
	   	  var.srtr  =  2  
	   	  var.sinv  =  2  
	   	  var.sedd  =  3  
	   	  var.sedr  =  3  
	   	  var.sedt  =  3  
	   	  var.sisf  =  3  
	   	  var.sism  =  3  
	  end if  
	   
'  |   *  Setting variables for Item Planning Data  
	  if Items.ExtraLeadTime  <  "0" then  
	   	  Items.ExtraLeadTime  =  "0"  
	  end if  
	  if Items.ForecastTimeFence  <  "0" then  
	   	  Items.ForecastTimeFence  =  "0"  
	  end if  
	  if Items.TimeFence  <  "0" then  
	   	  Items.TimeFence  =  "0"  
	  end if  
	  if Items.UnitForExtraLeadTime  =  0 then  
	   	  Items.UnitForExtraLeadTime  =  10  
	  end if  
	  if Items.TimeFenceUnit  =  0 then  
	   	  Items.TimeFenceUnit  =  10  
	  end if  
	  if Items.OrderHorizon  <=  "0" then  
	   	  if Items.MaintainMasterPlan  =  2 then  
	   	   	  Items.OrderHorizon  =  "180"  
	   	   	  var.cprpd100.ptmf  =  "180"  
	   	  else  
	   	   	  Items.OrderHorizon  =  "180"  
	   	   	  var.cprpd100.ptmf  =  "360"  
	   	  end if  	   	   	   
	  else  
	   	  if Items.MaintainMasterPlan  =  2 then  
	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  
	   	  else  
	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  *  2  
	   	  end if  
	  end if  
	   
'  |   	  DetermineSrce()  	   	   	   	   	  '  |   *  FP6.n '  |   *  249608.o  
	  var.tcibd001.srce  =  DetermineSrce(Items.ItemType)  	  '  |   *  FP6.n '  |   *  249608.n  
	  dump 001 '  |   *  Dump for tcibd001  
	  dump 400 '  |   *  Dump for whwmd400  
	   
	  if Items.ItemPurchaseData  <>  2 then  
	   	  dump 002 '  |   *  Dump for tdipu001  
'  |  243214.sn  
	   	  dump 102 '  |   *  Dump for tdipu100  
'  |  243214.en  
	  end if  
	   
	  if Items.ItemSalesData  <>  2 then  
	   	  dump 003 '  |   *  Dump for tdisa001  
	  end if  
	   
	  if Items.ItemProductionData  <>  2 and _  
	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5) then  
	   	  dump 004 '  |   *  Dump for tiipd001  
	  end if  
	   
	  if Items.ItemType  <>  6 and Items.ItemType  <>  10 then  
	   	  dump 007 '  |   *  Dump for ticpr007  
	  end if  
	   
	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  10) then  
	   	  dump 100 '  |   *  Dump for tcibd100  
	  end if  
	   
	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5 or Items.ItemType  =  10) then  
	   	  cluster.found  =  0  
	   	  If varstr.cprj  =  "" or IsNUll(varstr.cprj) then  
	   	   	  select  	  ItemsByCluster.*   
	   	   	  from  	  ItemsByCluster  
	   	   	  where  	  (ItemsByCluster.Project  =  "" and ItemsByCluster.Item  =  varstr.item)  
	   	   	  selectdo  
	   	   	   	  cluster.found  =  1  
	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	  '  |  244355.n  
	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	  '  |  244355.n  
	   	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	   	  dump 120 '  |   *  Dump for cprpd120  
	   	   	  endselect  
	   	  Else  
	   	   	  select  	  ItemsByCluster.*   
	   	   	  from  	  ItemsByCluster  
	   	   	  where  	  (ItemsByCluster.Project  =  varstr.cprj and ItemsByCluster.Item  =  varstr.item)  
	   	   	  selectdo  
	   	   	   	  cluster.found  =  1  
	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	  '  |  244355.n  
	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	  '  |  244355.n  
	   	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	   	  dump 120 '  |   *  Dump for cprpd120  
	   	   	  endselect  
	   	  End If  	   	   
	   	  if cluster.found  =  0 then  
	   	   	  varstr.clus  =  "   "  	   	   
	   	   	  var.planned.item  =  get.segment.cp.item.code(varstr.clus,varstr.cprj,varstr.item)  
	   	   	  var.cprpd100.cwar  =  Items.Warehouse  	   	   	  '  |  244355.n  
	   	   	  var.cprpd100.sour  =  1  	   	   	   	   	  '  |  244355.n  
	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	  dump 120 '  |   *  Dump for cprpd120  
	   	  end if  
	   	  dump 200 '  |   *  Dump for tcibd200  
	  end if  
	   
	  if Items.ItemServiceData  <>  2 and _  
	   	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  
	   	   	  dump 201 '  |   *  Dump for tsmdm200  
	  end if  
	  if Items.ItemProjectData  <>  2 then  
	   	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  	   
	   	   	  dump 005 '  |   *  Dump for tppdm005  
	   	  end if  
	  end if  
'  *  SL244268.so  
'  *  Logic warehouse item data moved to separate script  
'  	  if (Items.ItemType  =  1 or Items.ItemType  =  2) then  
'  *   	   	   |  dump 210 '  |   *  Dump for whwmd210  
'  *   	   	   |  dump 215 '  |   *  Dump for whwmd215  
'  *   	   	   |  dump 216 '  |   *  Dump for whwmd216  
'  	  end if  
'  *  SL244268.eo  
	
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:S
:QURY:START
select  	  Items.*
from 	  Items
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:D
:QURY:START
	  dump 64 '  |  PE to tcibd001  
	  dump 65 '  |  PE to tdipu001  
	  dump 66 '  |  PE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:S
:QURY:START
select ProjectEquipments.*
from ProjectEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:D
:QURY:START
	  if ProjectSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuti  
	  end if  
	  dump 74 '  |   *  PS to tcibd001  
	  dump 75 '  |   *  PS to tdipu001  
	  dump 76 '  |   *  PS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:S
:QURY:START
select ProjectSubcontractings.*
from ProjectSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:D
:QURY:START
	  if StandardEquipments.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 61 '  |   *  SE to tcibd001  
	  dump 62 '  |   *  SE to tdipu001  
	  dump 63 '  |   *  SE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:S
:QURY:START
select StandardEquipments.*
from StandardEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:D
:QURY:START
	  if StandardSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuti  
	  end if  
	  if StandardSubcontractings.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 71 '  |   *  SS to tcibd001  
	  dump 72 '  |   *  SS to tdipu001  
	  dump 73 '  |   *  SS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:S
:QURY:START
select StandardSubcontractings.*
from StandardSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:003
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ConversionFactors
:ICOD:D
:QURY:START
	  dump 003 '  |   *  tcibd003
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:003
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ConversionFactors
:ICOD:S
:QURY:START
select ConversionFactors.*
from ConversionFactors
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:003
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ConversionFactors
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:004
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemCodesByItemCodeSystem
:ICOD:D
:QURY:START
dump 004
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:004
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemCodesByItemCodeSystem
:ICOD:S
:QURY:START
select ItemCodesByItemCodeSystem.*
from ItemCodesByItemCodeSystem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:004
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemCodesByItemCodeSystem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AlternativeItems
:ICOD:D
:QURY:START
	  var.str.sdte  =  get.utc(AlternativeItems.IntroductionDate,"yes")  
	  var.str.edte  =  get.utc(AlternativeItems.ExpiryDate,"no")  
dump 005
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AlternativeItems
:ICOD:S
:QURY:START
select AlternativeItems.*
from AlternativeItems
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:ibd
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AlternativeItems
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:mcs
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Units
:ICOD:D
:QURY:START
	  dump 01 '  |   *  Units  
	  if trim(var.DefaultUnitSet)  <>  "" then  
	   	  dump 012 '  |   *  Units by Unit Set  	   
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:mcs
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Units
:ICOD:S
:QURY:START
select Units.*
from Units
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:mcs
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Units
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:mcs
:TFLNO:052
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:mcs
:TFLNO:052
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:S
:QURY:START
select Projects.*
from Projects
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tc
:TCMOD:mcs
:TFLNO:052
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:D
:QURY:START
	  var.tdipu010.scrp  =  ItemPurchaseBP.SourcingPercentage  
	  if (var.tdipu010.scrp  =  "0") then  
	   	  var.tdipu010.scrp  =  100  
	  end if  
	   
	  var.tdipu010.efdt  =  get.utc(ItemPurchaseBP.EffectiveDate,"yes")  
	  'var.tdipu010.exdt  =  get.utc(ItemPurchaseBP.ExpDate,"yes")  
	  If ItemPurchaseBP.ExpDate  =  "" or IsNull(ItemPurchaseBP.ExpDate) then  	   
	   	  var.tdipu010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tdipu010.exdt  =  get.utc(ItemPurchaseBP.ExpDate,"yes")  
	  end if  
	  varstr.cprj  =  ItemPurchaseBP.Project  
	  varstr.item  =  ItemPurchaseBP.Item  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select  	  Items.*   
	   	  from  	   	  Items  
	   	  where  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  else  
	   	  select Items.*   
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj AND Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  end if  
	  dump 010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:S
:QURY:START
select ItemPurchaseBP.*
from ItemPurchaseBP
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:D
:QURY:START
	  var.tdisa010.efdt  =  get.utc(ItemSalesBP.EffectiveDate,"yes")  
	  'var.tdisa010.exdt  =  get.utc(ItemSalesBP.ExpDate,"yes")  	   
	  If ItemSalesBP.ExpDate  =  "" or IsNull(ItemSalesBP.ExpDate) then  	   
	   	  var.tdisa010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tdisa010.exdt  =  get.utc(ItemSalesBP.ExpDate,"yes")  
	  end if  
dump 010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:S
:QURY:START
select ItemSalesBP.*
from ItemSalesBP
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:pcg
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixDefinitions
:ICOD:D
:QURY:START
dump 010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:pcg
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixDefinitions
:ICOD:S
:QURY:START
select MatrixDefinitions.*
from MatrixDefinitions
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:pcg
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixDefinitions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:pcg
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixSequences
:ICOD:D
:QURY:START
	  var.tdpcg020.efdt  =  get.utc(MatrixSequences.EffectiveDate,"yes")  
	  var.tdpcg020.exdt  =  get.utc(MatrixSequences.ExpiryDate,"no")  
	  dump 010 '  |  tdpcg020
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:pcg
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixSequences
:ICOD:S
:QURY:START
select MatrixSequences.*
from MatrixSequences
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:pcg
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixSequences
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:D
:QURY:START
	  var.tdpcg030.efdt  =  get.utc(Matrices.EffectiveDate,"yes")  
	   
	   
	  dump 030 '  |  tdpcg030
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:S
:QURY:START
select Matrices.*
from Matrices
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:D
:QURY:START
	  var.tdpcg031.efdt  =  get.utc(PriceBooks.EffectiveDate,"yes")  
	  var.tdpcg031.exdt  =  get.utc(PriceBooks.ExpiryDate,"no")  	   
	  var.tdpcg031.endt  =  get.utc(PriceBooks.EntryDate,"yes")  	   
	   
	  dump 031 '  |  tdpcg031
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:S
:QURY:START
select PriceBooks.*
from PriceBooks
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionType
:ICOD:D
:QURY:START
	  dump 002  	  '  |  tfgld002
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionType
:ICOD:S
:QURY:START
select DimensionType.*
from DimensionType
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionType
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Periods
:ICOD:D
:QURY:START
	  dump 1
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Periods
:ICOD:S
:QURY:START
select Periods.*
from Periods
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Periods
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:006
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:D
:QURY:START
	  var.tfgld006.ydsc  =  EndDatesByYear.ydsc  	   
	  ' |  Description is mandatory  
	  if EndDatesByYear.ydsc  =  empty then  
	   	  var.tfgld006.ydsc  =  EndDatesByYear.year  
	  end if  
	  dump 1
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:006
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:S
:QURY:START
select EndDatesByYear.*
from EndDatesByYear
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:006
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:007
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Periods
:ICOD:D
:QURY:START
	  var.user  =  GeneralParameters.MigrationUser  
	   
	  yr  =  YEAR(date)  
	  if Periods.year  <  (yr  -  1) then  
	   	  var.status  =  3 '  |  tfgld.sper.finally.closed  
	  end if  
	  if Periods.year  =  yr or Periods.year  =  yr  -  1 then  
	   	  if Periods.stdt  <=  GeneralParameters.RetroDate then  
	   	   	  var.status  =  2 '  |  tfgld.sper.closed  
	   	  else  
	   	   	  var.status  =  1 '  |  tfgld.sper.open  
	   	  end if  	   
	  end if  
	  dump 007  	  '  |  Periods  	
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:007
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Periods
:ICOD:S
:QURY:START
select Periods.*
from Periods
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:007
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Periods
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:D
:QURY:START
	  If Trim(varstr.SourceGLVersion)  =  "Other" then  
	  '  |  Migrate non  -  InforFMS data  
	   	  if ChartOfAccounts.Dimension1Used  =  "0" then  
	   	   	  var.dim1  =  2 '  |  Optional  
	   	  else  
	   	   	  var.dim1  =  ChartOfAccounts.Dimension1Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension2Used  =  "0" then  
	   	   	  var.dim2  =  2  
	   	  else  
	   	   	  var.dim2  =  ChartOfAccounts.Dimension2Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension3Used  =  "0" then  
	   	   	  var.dim3  =  2  
	   	  else  
	   	   	  var.dim3  =  ChartOfAccounts.Dimension3Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension4Used  =  "0" then  
	   	   	  var.dim4  =  2  
	   	  else  
	   	   	  var.dim4  =  ChartOfAccounts.Dimension4Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension5Used  =  "0" then  
	   	   	  var.dim5  =  2  
	   	  else  
	   	   	  var.dim5  =  ChartOfAccounts.Dimension5Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension6Used  =  "0" then  
	   	   	  var.dim6  =  2  
	   	  else  
	   	   	  var.dim6  =  ChartOfAccounts.Dimension6Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension7Used  =  "0" then  
	   	   	  var.dim7  =  2  
	   	  else  
	   	   	  var.dim7  =  ChartOfAccounts.Dimension7Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension8Used  =  "0" then  
	   	   	  var.dim8  =  2  
	   	  else  
	   	   	  var.dim8  =  ChartOfAccounts.Dimension8Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension9Used  =  "0" then  
	   	   	  var.dim9  =  2  
	   	  else  
	   	   	  var.dim9  =  ChartOfAccounts.Dimension9Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension10Used  =  "0" then  
	   	   	  var.dim10  =  2  
	   	  else  
	   	   	  var.dim10  =  ChartOfAccounts.Dimension10Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension11Used  =  "0" then  
	   	   	  var.dim11  =  2  
	   	  else  
	   	   	  var.dim11  =  ChartOfAccounts.Dimension11Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension12Used  =  "0" then  
	   	   	  var.dim12  =  2  
	   	  else  
	   	   	  var.dim12  =  ChartOfAccounts.Dimension12Used  
	   	  end if  
	   	  if ChartOfAccounts.DualAccountingIndicator  =  "0" then  
	   	   	  var.duac  =  1  
	   	  else  
	   	   	  var.duac  =  ChartOfAccounts.DualAccountingIndicator  
	   	  end if  
	   	  if ChartOfAccounts.FixedAssetIntegration  =  "0" then  
	   	   	  var.ifas  =  4  
	   	  else  
	   	   	  var.ifas  =  ChartOfAccounts.FixedAssetIntegration  
	   	  end if  
	   	  if ChartOfAccounts.IntegrationAccount  =  "0" then  
	   	   	  var.inta  =  2  
	   	  else  
	   	   	  var.inta  =  ChartOfAccounts.IntegrationAccount  
	   	  end if  
	   	  if ChartOfAccounts.IntegrationIndicator  =  "0" then  
	   	   	  var.iprj  =  7  
	   	  else  
	   	   	  var.iprj  =  ChartOfAccounts.IntegrationIndicator  
	   	  end if  
	   	  if ChartOfAccounts.BlockingStatus  =  "0" or Trim(ChartOfAccounts.BlockingStatus)  =  "" then  
	   	   	  var.bloc  =  1  
	   	  else  
	   	   	  var.bloc  =  ChartOfAccounts.BlockingStatus  
	   	  end if  
	   	  if var.bloc  =  1 then  
	   	   	  var.bfdt  =  get.date("","no")  
	   	   	  var.budt  =  get.date("","no")  
	   	  else  
	   	   	  var.bfdt  =  get.date(ChartOfAccounts.BlockingEffectiveFrom,"no")  
	   	   	  var.budt  =  get.date(ChartOfAccounts.BlockingEffectiveTo,"no")  
	   	  end if  
	   	  dump 008  
	  else  
	  '  |  Migrate InforFMS data  
	   	  '  |  Mapping of AccountType to D  /  C Indicator  
	   	  acc.type  =  ChartOfAccounts.AccountTypeInforFMS  
	   	  if trim(acc.type)  <>  "" then  
	   	   	  varstr.OpenDate  =  ChartOfAccounts.OpenDateInforFMS  
	   	   	  varstr.ClosedDate  =  ChartOfAccounts.ClosedDateInforFMS  
	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Closed" then  
	   	   	   	  if varstr.OpenDate  =  "" then  
	   	   	   	   	  varstr.OpenDate  =  date()  
	   	   	   	  end if  
	   	   	   	  if varstr.ClosedDate  =  "" then  	   	   	   
	   	   	   	   	  varstr.ClosedDate  =  CDate("12/31/2038")  
	   	   	   	  end if  
	   	   	  end if  
	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Open" then  
	   	   	   	  varstr.OpenDate  =  ""  
	   	   	   	  varstr.ClosedDate  =  ""  
	   	   	  end if  
	   	   	  If acc.type  =  "A" or acc.type  =  "E" or acc.type  =  "V" or acc.type  =  "B" then  
	   	   	   	  varint.DebitCreditIndicator  =  1 '  |  tfgld.dbcr.debit '  |  1 '  |  Debit  
	   	   	  End If  	   
	   	   	  If acc.type  =  "L" or acc.type  =  "I" then  
	   	   	   	  varint.DebitCreditIndicator  =  2 '  |  tfgld.dbcr.credit '  |  2 '  |  Credit  	   
	   	   	  End If  	   
	   	   	  '  |  Mentioning the Account Type  
	   	   	  If acc.type  =  "A" or acc.type  =  "L" or acc.type  =  "B" then  
	   	   	   	  varint.AccountType  =  1 '  |  Balance Sheet  
	   	   	  End If  
	   	   	  if acc.type  =  "E" or acc.type  =  "V" or acc.type  =  "I" then  
	   	   	   	  varint.AccountType  =  2 '  |  Profit  &  Loss  
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GL2" then  
	   	   	   	  '  |  Determining the Status for the Blocking field  
	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free '  |  1  
	   	   	   	  '  |  Currency Analysis  
	   	   	   	  var.icur  =  1 '  |  tcicur.not.required '  |  1  
	   	   	   	  '  |  For Sublevel  
	   	   	   	  var.sublevel  =  0 '  |  ChartOfAccounts.Sublevel '  |  default()  
	   	   
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GL3" then  
	   	   	   	  '  |  Determining the Status for the Blocking field  
	   	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Open" then  
	   	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free '  |  1  
	   	   	   	  else  	   	   
	   	   	   	   	  var.status  =  3 '  |  tfgld.bloc.all.input '  |  3  
	   	   	   	  end if  
	   	   	   	  '  |  Currency Analysis  
	   	   	   	  var.icur  =  2 '  |  tcicur.required '  |  2  
	   	   	   	  '  |  For Sublevel  
	   	   	   	  var.sublevel  =  0 '  |  ChartOfAccounts.Sublevel '  |  default()  
	   
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GLE" then  
	   	   	   	  if acc.type  =  "1" or acc.type  =  "5" or acc.type  =  "6" or acc.type  =  "8" then  
	   	   	   	   	  varint.DebitCreditIndicator  =  1 '  |  tfgld.dbcr.debit  
	   	   	   	  end if  	   
	   	   	   	  if acc.type  =  "2" or acc.type  =  "3" or acc.type  =  "4" or acc.type  =  "7" then  
	   	   	   	   	  varint.DebitCreditIndicator  =  2 '  |  tfgld.dbcr.credit  
	   	   	   	  end if  	   
	   	   	   	  '  |  Mentioning the Account Type  
	   	   	   	  if acc.type  =  "1" or acc.type  =  "2" or acc.type  =  "3" then  
	   	   	   	   	  varint.AccountType  =  1 '  |  Balance Sheet  
	   	   	   	  else  
	   	   	   	   	  varint.AccountType  =  2 '  |  Profit  &  Loss  
	   	   	   	  end if  	   
	   	   	   	  '  |  Currency Analysis  	   
	   	   	   	  var.icur  =  1 '  |  tcicur.not.required  
	   	   	   	  '  |  Status of Blocking field  
	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free  
	   	   	   	  '  |  Calculating Sublevel  
	   	   	   	  var.sublevel  =  ChartOfAccounts.LedgerAccountSublevel  
	   
	   	   	  end if  
	   	   	  dump 009 '  |  Chart Of Accounts InforFMS  
	   	  end if  
	  End If
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:S
:QURY:START
select ChartOfAccounts.*
from ChartOfAccounts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:009
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionRangesbyLedgerAccount
:ICOD:D
:QURY:START
	  varstr.dcf  =  DimensionRangesbyLedgerAccount.DimensionFrom  
	  varstr.dct  =  DimensionRangesbyLedgerAccount.DimensionTo  
	  var.ledger.account  =  DimensionRangesbyLedgerAccount.LedgerAccount  
	  if Trim(varstr.source.gl.version)  =  "GLE" then  
	   	  varstr.dcf  =  Empty  
	   	  'KH.o varstr.dct  =  CDate("1/1/2038") '  |  2038 '  |  max(Date())  
	   	  varstr.dct  =  "ZZZZZZZZZ" 'KH.n  
	   	  var.ledger.account  =  get.ledger.account(DimensionRangesbyLedgerAccount.LedgerAccount)  
	  end if  
	  dump 009
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:009
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionRangesbyLedgerAccount
:ICOD:S
:QURY:START
select DimensionRangesbyLedgerAccount.*
from DimensionRangesbyLedgerAccount
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:009
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionRangesbyLedgerAccount
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Dimensions
:ICOD:D
:QURY:START
	  if Trim(varstr.source.gl.version)  =  "Other" then  
	  '  |  Migrate non  -  Infor FMS data  
	   	   
	   	  if IsNull(Dimensions.TypeOfDimension) or Trim(Dimensions.TypeOfDimension)  =  "" or Trim(Dimensions.TypeOfDimension)  =  "0" then  
	   	   	  var.tfgld010.atyp  =  1 '  |  Normal  
	   	  else  
	   	   	  var.tfgld010.atyp  =  Dimensions.TypeOfDimension  
	   	  end if  
	   	  if IsNull(Dimensions.BlockingStatus) or Trim(Dimensions.BlockingStatus)  =  "" or Trim(Dimensions.BlockingStatus)  =  "0" then  
	   	   	  var.tfgld010.bloc  =  1  	  '  |  Free  
	   	  else  
	   	   	  var.tfgld010.bloc  =  Dimensions.BlockingStatus  
	   	  end if  
	   	  if var.tfgld010.bloc  =  1 then  
	   	   	  var.tfgld010.bfdt  =  ""  
	   	   	  var.tfgld010.budt  =  ""  
	   	  else  
	   	   	  if Dimensions.BlockingEffectiveFrom  =  empty then  
	   	   	   	  var.tfgld010.bfdt  =  Date()  
	   	   	  else  
	   	   	   	  var.tfgld010.bfdt  =  Dimensions.BlockingEffectiveFrom  
	   	   	  end if  
	   	   	  if Dimensions.BlockingEffectiveTo  =  empty then  
	   	   	   	  var.tfgld010.budt  =  CDate("12/31/2038")  
	   	   	  else  
	   	   	   	  var.tfgld010.budt  =  Dimensions.BlockingEffectiveTo  
	   	   	  end if  
	   	  end if  
	   	   	   	   
	   	  dump 010  	  '  |  Dimensions non  -  Infor FMS  
	  else  
	  '  |  Migrate Infor FMS data  
	   	  select Dimensions.*   	   
	   	  from  	  Dimensions  	   
	   	  where  	  Dimensions.ParentDimension  =  varstr.root  
	   	  selectdo  
	   	   	  if IsNull(Dimensions.TypeOfDimension) or Dimensions.TypeOfDimension  =  "" then  
	   	   	   	  var.tfgld010.atyp  =  2  
	   	   	  else  
	   	   	   	  var.tfgld010.atyp  =  Dimensions.Type  
	   	   	  end if  
	   	   	  if varstr.source.gl.version  =  "GL2" then  
	   	   	   	  var.tfgld010.bloc  =  1 '  |  tfgld.bloc.free  
	   	   	  else  
	   	   	   	  if Dimensions.StatusInforFMS  =  "Open" then  
	   	   	   	   	  var.tfgld010.bloc  =  1 '  |  tfgld.bloc.free  
	   	   	   	  else  	   	   
	   	   	   	   	  var.tfgld010.bloc  =  3 '  |  tfgld.bloc.all.input  
	   	   	   	  end if  
	   	   	  end if  
	   	   	  varstr.dimcode  =  Dimensions.Dimension  
	   	   	  MaxDepthStructure  =  DetermineDepthStructure(varstr.dimcode,varint.depth,0)  	   
	   	   	  MaxDepth  =  varint.depth  
	   	   	  varint.sublevel  =  MaxDepthStructure  
	   	   	  if var.tfgld010.bloc  =  1 then  
	   	   	   	  var.tfgld010.bfdt  =  ""  
	   	   	   	  var.tfgld010.budt  =  ""  
	   	   	  else  
	   	   	   	  if Dimensions.OpenDateInforFMS  =  0 or Dimensions.OpenDateInforFMS  =  "" then  
	   	   	   	   	  var.tfgld010.bfdt  =  Date()  
	   	   	   	  else  
	   	   	   	   	  var.tfgld010.bfdt  =  Dimensions.OpenDateInforFMS  
	   	   	   	  end if  
	   	   	   	  if Dimensions.ClosedDateInforFMS  =  0 or Dimensions.ClosedDateInforFMS  =  "" then  
	   	   	   	   	  var.tfgld010.budt  =  CDate("12/31/2038")  
	   	   	   	  else  
	   	   	   	   	  var.tfgld010.budt  =  Dimensions.ClosedDateInforFMS  
	   	   	   	  end if  
	   	   	  end if  
	   	   	   	   
	   
	   	   	  dump 910  	  '  |  Dimensions Infor FMS  
	   	   	  ChildNodes  =  DetermineChildrenStructure(varstr.dimcode, varint.sublevel)  
	   
	   	  endselect  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Dimensions
:ICOD:S
:QURY:START
select Dimensions.*
from Dimensions
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Dimensions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:D
:QURY:START
	  dump 011
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:S
:QURY:START
select TransactionTypes.*
from TransactionTypes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:014
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:D
:QURY:START
	  dump 014 '  |  Last Used Batch  
	  dump 019 '  |  Finalization Run Number Status
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:014
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:S
:QURY:START
select  	  EndDatesByYear.*
from 	  EndDatesByYear
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:014
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:017
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypeSeries
:ICOD:D
:QURY:START
	  dump 017
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:017
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypeSeries
:ICOD:S
:QURY:START
select  	  TransactionTypeSeries.*
from 	  TransactionTypeSeries
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:017
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypeSeries
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:D
:QURY:START
	  dump 100  	  '  |  Financial Batch
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:S
:QURY:START
select EndDatesByYear.*
from EndDatesByYear
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:D
:QURY:START
	  If varstr.source.gl.version  =  "GL2" or varstr.source.gl.version  =  "GL3" then  
	  '  |  Migrate data for InforFMS 'M  -  Series'  
	   	  If GLTransactions.CurrencySource  =  empty then  
	   	   	  varstr.currency  =  GeneralParameters.BookingCurrency1  
	   	  Else  
	   	   	  varstr.currency  =  GLTransactions.CurrencySource  
	   	  End If  
	   	   
	   	  var.rate1  =  get.rate(GLTransactions.Rate1, var.RateFactor1)  
	   	  var.rate2  =  get.rate(GLTransactions.Rate2, var.RateFactor2)  
	   	  If GLTransactions.RateDate  =  empty then  
	   	   	  var.RateDate  =  GLTransactions.EffectiveDateInforFMS  
	   	  Else  
	   	   	  var.RateDate  =  GLTransactions.RateDate  
	   	  End If  
	   	  if trim(var.rate1)  =  "" then  	   
	   	   	  var.rate1  =  "1.000000"  
	   	  end if  
	   	  if trim(var.rate2)  =  "" then  	   
	   	   	  var.rate2  =  "0.000001"  
	   	  end if  
	   	  If GLTransactions.RateTypeSource  =  empty then  
	   	   	  varstr.RateType  =  GeneralParameters.ExchangeRateType  
	   	  Else  
	   	   	  varstr.RateType  =  GLTransactions.RateTypeSource  
	   	  End If  
	   	  If varstr.source.gl.version  =  "GL2" then  
	   	   	  var.GLTransaction.BookingAmount2  =  GLTransactions.BookingAmount2  
	   	  Else  
	   	   	  var.GLTransaction.BookingAmount2  =  0  
	   	  End If  
	   	  If GLTransactions.EffectiveDateInforFMS  <>  varstr.PrevEffectiveDate then  
	   	   	  var.tfgld106.olin  =  1  	   
	   	   	  If varstr.source.gl.version  =  "GL2" then  	   
	   	   	   	  var.DocumentID  =  var.DocumentID  +  1  
	   	   	   	  dump 018 '  |  Documents InforFMS GL2  /  GL3  
	   	   	  End If  
	   	  Else  
	   	   	  var.tfgld106.olin  =  var.tfgld106.olin  +  1  
	   	  End if  
	   	  varstr.PrevEffectiveDate  =  GLTransactions.EffectiveDateInforFMS  
	  End If  
	  varstr.dim2  =  Mid (GLTransactions.Reference1 , 22 , 1 )  
	  varstr.dim3  =  Mid (GLTransactions.Reference1 , 24 , 9 )  
	  dump 106 '  |  Finalized Transactions InforFMS GL2  /  GL3  
	  If varstr.source.gl.version  =  "GLE" then  
	  '  |  Migrate data for InforFMS 'E  -  Series'  
	   	  select  	  GLTransactions.*   
	   	  from  	  GLTransactions  
	   	  order by GLTransactions.FiscalYear, GLTransactions.Period Asc  
	   	  selectdo  
	   	   	  If GLTransactions.CurrencySource  =  empty then  
	   	   	   	  varstr.currency  =  GeneralParameters.BookingCurrency1  
	   	   	  Else  
	   	   	   	  varstr.currency  =  GLTransactions.CurrencySource  
	   	   	  End If  
	   	   	  var.rate1  =  get.rate(GLTransactions.Rate1, var.RateFactor1)  
	   	   	  var.rate2  =  get.rate(GLTransactions.Rate2, var.RateFactor2)  
	   	   	  If GLTransactions.RateDate  =  empty then  
	   	   	   	  var.RateDate  =  GLTransactions.EffectiveDate  
	   	   	  Else  
	   	   	   	  var.RateDate  =  GLTransactions.RateDate  
	   	   	  End If  
	   	   	  If GLTransactions.RateTypeSource  =  empty then  
	   	   	   	  varstr.RateType  =  GeneralParameters.ExchangeRateType  
	   	   	  Else  
	   	   	   	  varstr.RateType  =  GLTransactions.RateTypeSource  
	   	   	  End If  
	   	   	  If GLTransactions.FiscalYear  <>  varint.PrevFiscalYear Or GLTransactions.Period  <>  varint.PrevPeriod then  
	   	   	   	  var.DocumentID  =  var.DocumentID  +  1  
	   	   	   	  dump 918 '  |  Documents InforFMS GLE  
	   	  End If  
	   	  varint.PrevFiscalYear  =  GLTransactions.FiscalYear  
	   	  varint.PrevPeriod  =  GLTransactions.Period  
	   	  dump 906 '  |  Finalized Transactions InforFMS GLE  
	  endselect  
End If  
If varstr.source.gl.version  =  "Other" then  
'  |  Migrate data for other source systems  
End If
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:S
:QURY:START
select  	  GLTransactions.*
from 	  GLTransactions  
' | order by GLTransactions.EffectiveDateInforFMS Asc
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:205
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PeriodTotals
:ICOD:D
:QURY:START
	  If PeriodTotals.CurrencySource  =  empty then  
	   	  var.currency  =  GeneralParameters.BookingCurrency1  
	  Else  
	   	  var.currency  =  PeriodTotals.CurrencySource  
	  End If  
	  if var.gl.version  =  "GL2" or var.gl.version  =  "GLE" then  
	   	  if PeriodTotals.DebitBalanceBC1  =  0 then  
	   	   	  var.debit.balance1  =  PeriodTotals.DebitBalance  
	   	  else  
	   	   	  var.debit.balance1  =  PeriodTotals.DebitBalanceBC1  
	   	  end if  
	   	  if PeriodTotals.CreditBalanceBC1  =  0 then  
	   	   	  var.credit.balance1  =  PeriodTotals.CreditBalance  
	   	  else  
	   	   	  var.credit.balance1  =  PeriodTotals.CreditBalanceBC1  
	   	  end if  
	   	  var.debit.balance2  	   =  0  
	   	  var.debit.balance3  	   =  0  
	   	  var.credit.balance2  	   =  0  
	   	  var.credit.balance3  	   =  0  
	   	  var.finalized.qty1  	   =  PeriodTotals.Quantity1  
	   	  var.finalized.qty2  	   =  0  
	   	   
	  elseif var.gl.version  =  "GL3" then  
	   	  var.debit.balance1  	   =  PeriodTotals.DebitBalanceBC1  
	   	  var.debit.balance2  	   =  PeriodTotals.DebitBalanceBC2  
	   	  var.debit.balance2  	   =  0  
	   	  var.credit.balance1  	   =  PeriodTotals.CreditBalanceBC1  
	   	  var.credit.balance2  	   =  PeriodTotals.CreditBalanceBC2  
	   	  var.credit.balance2  	   =  0  
	   	  var.finalized.qty1  	   =  PeriodTotals.Quantity1  
	   	  var.finalized.qty2  	   =  PeriodTotals.Quantity2  
	  end if  
	   
	  '  |  Each Period Totals record should have 12 records in tfgld202 corresponding to each dimension.  
	  '  |  Only when the dimensiontype is present in DimensionType table (Mandatory or Optional) then a record is dumped  
	  if var.DimensionTypePresent1  =  "present" then  
	   	  var.code1  =  get.dimension.mapping(PeriodTotals.DimCodeSource1)  
	   	  var.tfgld202.dtyp  =  1  
	   	  var.tfgld202.dimx  =  var.code1  
	   	  if var.tfgld202.dimx  <>  "" then  
	   	   	  '  |  Dump 202 record if dimx has a value  
	   	   	  dump 202 '  |  History  -  Dimensions  /  Ledger Account Totals  
	   	  end if  
	  end if  
	  if var.DimensionTypePresent2  =  "present" then  
	   	  var.code2  =  get.dimension.mapping(PeriodTotals.DimCodeSource2)  
	   	  var.tfgld202.dtyp  =  2  
	   	  var.tfgld202.dimx  =  var.code2  
	   	  if var.tfgld202.dimx  <>  "" then  
	   	   	  '  |  Dump 202 record if dimx has a value  
	   	   	  dump 202 '  |  History  -  Dimensions  /  Ledger Account Totals  
	   	  end if  
	  end if  
	  if var.DimensionTypePresent3  =  "present" then  
	   	  var.code3  =  get.dimension.mapping(PeriodTotals.DimCodeSource3)  
	   	  var.tfgld202.dtyp  =  3  
	   	  var.tfgld202.dimx  =  var.code3  
	   	  if var.tfgld202.dimx  <>  "" then  
	   	   	  '  |  Dump 202 record if dimx has a value  
	   	   	  dump 202 '  |  History  -  Dimensions  /  Ledger Account Totals  
	   	  end if  
	  end if  
	  if var.DimensionTypePresent4  =  "present" then  
	   	  var.code4  =  get.dimension.mapping(PeriodTotals.DimCodeSource4)  
	   	  var.tfgld202.dtyp  =  4  
	   	  var.tfgld202.dimx  =  var.code4  
	   	  if var.tfgld202.dimx  <>  "" then  
	   	   	  '  |  Dump 202 record if dimx has a value  
	   	   	  dump 202 '  |  History  -  Dimensions  /  Ledger Account Totals  
	   	  end if  
	  end if  	   
	  if var.DimensionTypePresent5  =  "present" then  
	   	  var.code5  =  get.dimension.mapping(PeriodTotals.DimCodeSource5)  
	   	  var.tfgld202.dtyp  =  5  
	   	  var.tfgld202.dimx  =  var.code5  
	   	  if var.tfgld202.dimx  <>  "" then  
	   	   	  '  |  Dump 202 record if dimx has a value  
	   	   	  dump 202 '  |  History  -  Dimensions  /  Ledger Account Totals  
	   	  end if  
	  end if  
	  if var.DimensionTypePresent6  =  "present" then  
	   	  var.code6  =  get.dimension.mapping(PeriodTotals.DimCodeSource6)  
	   	  var.tfgld202.dtyp  =  6  
	   	  var.tfgld202.dimx  =  var.code6  
	   	  if var.tfgld202.dimx  <>  "" then  
	   	   	  '  |  Dump 202 record if dimx has a value  
	   	   	  dump 202 '  |  History  -  Dimensions  /  Ledger Account Totals  
	   	  end if  
	  end if  	   
	  if var.DimensionTypePresent7  =  "present" then  
	   	  var.code7  =  get.dimension.mapping(PeriodTotals.DimCodeSource7)  
	   	  var.tfgld202.dtyp  =  7  
	   	  var.tfgld202.dimx  =  var.code7  
	   	  if var.tfgld202.dimx  <>  "" then  
	   	   	  '  |  Dump 202 record if dimx has a value  
	   	   	  dump 202 '  |  History  -  Dimensions  /  Ledger Account Totals  
	   	  end if  
	  end if  	   
	  if var.DimensionTypePresent8  =  "present" then  
	   	  var.code8  =  get.dimension.mapping(PeriodTotals.DimCodeSource8)  
	   	  var.tfgld202.dtyp  =  8  
	   	  var.tfgld202.dimx  =  var.code8  
	   	  if var.tfgld202.dimx  <>  "" then  
	   	   	  '  |  Dump 202 record if dimx has a value  
	   	   	  dump 202 '  |  History  -  Dimensions  /  Ledger Account Totals  
	   	  end if  
	  end if  	   
	  if var.DimensionTypePresent9  =  "present" then  
	   	  var.code9  =  get.dimension.mapping(PeriodTotals.DimCodeSource9)  
	   	  var.tfgld202.dtyp  =  9  
	   	  var.tfgld202.dimx  =  var.code9  
	   	  if var.tfgld202.dimx  <>  "" then  
	   	   	  '  |  Dump 202 record if dimx has a value  
	   	   	  dump 202 '  |  History  -  Dimensions  /  Ledger Account Totals  
	   	  end if  
	  end if  	   
	  if var.DimensionTypePresent10  =  "present" then  
	   	  var.code10  =  get.dimension.mapping(PeriodTotals.DimCodeSource10)  
	   	  var.tfgld202.dtyp  =  10  
	   	  var.tfgld202.dimx  =  var.code10  
	   	  if var.tfgld202.dimx  <>  "" then  
	   	   	  '  |  Dump 202 record if dimx has a value  
	   	   	  dump 202 '  |  History  -  Dimensions  /  Ledger Account Totals  
	   	  end if  
	  end if  	   
	  if var.DimensionTypePresent11  =  "present" then  
	   	  var.code11  =  get.dimension.mapping(PeriodTotals.DimCodeSource11)  
	   	  var.tfgld202.dtyp  =  11  
	   	  var.tfgld202.dimx  =  var.code11  
	   	  if var.tfgld202.dimx  <>  "" then  
	   	   	  '  |  Dump 202 record if dimx has a value  
	   	   	  dump 202 '  |  History  -  Dimensions  /  Ledger Account Totals  
	   	  end if  
	  end if  	   
	  if var.DimensionTypePresent12  =  "present" then  
	   	  var.code12  =  get.dimension.mapping(PeriodTotals.DimCodeSource12)  
	   	  var.tfgld202.dtyp  =  12  
	   	  var.tfgld202.dimx  =  var.code12  
	   	  if var.tfgld202.dimx  <>  "" then  
	   	   	  '  |  Dump 202 record if dimx has a value  
	   	   	  dump 202 '  |  History  -  Dimensions  /  Ledger Account Totals  
	   	  end if  
	  end if  	   
	   
	  '  |  For each record in the PeriodTotals a record for tfgld205 is dumped.  
	  var.dims  =  Mid(var.code6, 1,9)  &  Mid(var.code7,1,9)  &  Mid(var.code8,1,9)  &  Mid(var.code9,1,9)  &  Mid(var.code10,1,9)  &  Mid(var.code11,1,9)  &  Mid(var.code12,1,9)  
	  dump 205 '  |  History  -  Dimensions  /  Ledger Account Combination Totals  
	  if (varint.FiscalYear  <>  PeriodTotals.FiscalYear or varint.Period  <>  PeriodTotals.Period or varstr.AccountSource  <>  PeriodTotals.AccountSource) then  
	   	  '  |  Dump sumarized values previous combination FiscalYear  /  Period  /  AccountSource  
	   	  '  |  but skip the first pass  
	   	  if varstr.AccountSource  <>  "" then  
	   	   	  dump 201 '  |  History  -  Ledger Account Totals  
	   	  end if  
	   	  '  |  Reset total values and store orderby variables.  
	   	  varint.FiscalYear  	   =  PeriodTotals.FiscalYear  
	   	  varint.Period  	   	   =  PeriodTotals.Period  
	   	  varstr.AccountSource  	   =  PeriodTotals.AccountSource  	   	   	   	   
	   	  var.total.debit.balance  	   =  0  
	   	  var.total.credit.balance  	   =  0  
	   	  var.total.finalized.qty1  	   =  0  
	   	  var.total.finalized.qty2  	   =  0  	   	   	   	   
	   	  'Below home currencies variables  
	   	  var.total.debit.balance1  	   =  0  
	   	  var.total.credit.balance1  	   =  0  
	   	  var.total.debit.balance2  	   =  0  
	   	  var.total.credit.balance2  	   =  0  
	   	  var.total.debit.balance3  	   =  0  
	   	  var.total.credit.balance3  	   =  0  
	  end if  
	  var.total.debit.balance  	   =  var.total.debit.balance  	   +  PeriodTotals.DebitBalance  
	  var.total.credit.balance  	   =  var.total.credit.balance  	   +  PeriodTotals.CreditBalance  
	  var.total.debit.balance1  	   =  var.total.debit.balance1  	   +  var.debit.balance1  
	  var.total.debit.balance2  	   =  var.total.debit.balance2  	   +  var.debit.balance2  
	  var.total.credit.balance1  	   =  var.total.credit.balance1  	   +  var.credit.balance1  
	  var.total.credit.balance2  	   =  var.total.credit.balance2  	   +  var.credit.balance2  
	  var.total.finalized.qty1  	   =  var.total.finalized.qty1  	   +  var.finalized.qty1  
	  var.total.finalized.qty2  	   =  var.total.finalized.qty2  	   +  var.finalized.qty2  
	
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:205
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PeriodTotals
:ICOD:S
:QURY:START
select PeriodTotals.*
from PeriodTotals
order by PeriodTotals.FiscalYear, PeriodTotals.Period, PeriodTotals.AccountSource
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:205
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PeriodTotals
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:206
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpeningBalance
:ICOD:D
:QURY:START
	  if var.gl.version  =  "GL2" or var.gl.version  =  "GLE" then  
	   	  '  |  GL2  +  GLE Are single currency systems transaction amount is also the  
	   	  '  |  amount in home currencies  
	   	  var.opening.balance1  =  OpeningBalance.Amount  
	   	  var.opening.balance2  =  0  
	   	  var.opening.balance3  =  0  	   	   
	   	  var.finalized.qty2  =  0  
	  elseif var.gl.version  =  "GL3" then  
	   	  var.opening.balance1  =  OpeningBalance.AmountBC1  
	   	  var.opening.balance2  =  OpeningBalance.AmountBC2  
	   	  var.opening.balance3  =  0  	   	   
	   	  var.finalized.qty2  =  OpeningBalance.Quantity2  
	  end if  
	   
'  |  For every dimension in Opening Balance table, a record should be created in tfgld204 table.  
'  |  So for every record in Opening Balance, 12 records in tfgld204 as there are 12 dimensions in Opening Balance.  
'  |  Only when the dimensiontype is used (Mandatory or Optional) then a record is dumped  
	  if var.DimensionType1Used  >  1 then '  |  value 1 is "not used"  
	   	  var.code1  =  get.dimension.mapping(OpeningBalance.DimCodeSource1)  	   
	   	  var.dtyp  =  1  
	   	  var.dimx  =  var.code1  
	   	  if var.dimx  <>  "" then  
	   	   	  '  |  Dump 204 dimx record if dimx has a value  
	   	   	  dump 204  	  '  |  Opening Balances  -  Dimension  /  Ledger  /  Currency  
	   	  end if  
	  end if  
	  if var.DimensionType2Used  >  1 then '  |  value 1 is "not used"  
	   	  var.code2  =  get.dimension.mapping(OpeningBalance.DimCodeSource2)  	   
	   	  var.dtyp  =  2  
	   	  var.dimx  =  var.code2  
	   	  if var.dimx  <>  "" then  
	   	   	  '  |  Dump 204 dimx record if dimx has a value  
	   	   	  dump 204  	  '  |  Opening Balances  -  Dimension  /  Ledger  /  Currency  
	   	  end if  	   
	  end if  
	  if var.DimensionType3Used  >  1 then '  |  value 1 is "not used"  
	   	  var.code3  =  get.dimension.mapping(OpeningBalance.DimCodeSource3)  	   
	   	  var.dtyp  =  3  
	   	  var.dimx  =  var.code3  
	   	  if var.dimx  <>  "" then  
	   	   	  '  |  Dump 204 dimx record if dimx has a value  
	   	   	  dump 204  	  '  |  Opening Balances  -  Dimension  /  Ledger  /  Currency  
	   	  end if  
	  end if  
	  if var.DimensionType4Used  >  1 then '  |  value 1 is "not used"  	   
	   	  var.code4  =  get.dimension.mapping(OpeningBalance.DimCodeSource4)  	   
	   	  var.dtyp  =  4  
	   	  var.dimx  =  var.code4  
	   	  if var.dimx  <>  "" then  
	   	   	  '  |  Dump 204 dimx record if dimx has a value  
	   	   	  dump 204  	  '  |  Opening Balances  -  Dimension  /  Ledger  /  Currency  
	   	  end if  
	  end if  
	  if var.DimensionType5Used  >  1 then '  |  value 1 is "not used"  	   
	   	  var.code5  =  get.dimension.mapping(OpeningBalance.DimCodeSource5)  	   
	   	  var.dtyp  =  5  
	   	  var.dimx  =  var.code5  
	   	  if var.dimx  <>  "" then  
	   	   	  '  |  Dump 204 dimx record if dimx has a value  
	   	   	  dump 204  	  '  |  Opening Balances  -  Dimension  /  Ledger  /  Currency  
	   	  end if  
	  end if  
	  if var.DimensionType6Used  >  1 then '  |  value 1 is "not used"  	   
	   	  var.code6  =  get.dimension.mapping(OpeningBalance.DimCodeSource6)  	   
	   	  var.dtyp  =  6  
	   	  var.dimx  =  var.code6  
	   	  if var.dimx  <>  "" then  
	   	   	  '  |  Dump 204 dimx record if dimx has a value  
	   	   	  dump 204  	  '  |  Opening Balances  -  Dimension  /  Ledger  /  Currency  
	   	  end if  
	  end if  
	  if var.DimensionType7Used  >  1 then '  |  value 1 is "not used"  	   
	   	  var.code7  =  get.dimension.mapping(OpeningBalance.DimCodeSource7)  	   
	   	  var.dtyp  =  7  
	   	  var.dimx  =  var.code7  
	   	  if var.dimx  <>  "" then  
	   	   	  '  |  Dump 204 dimx record if dimx has a value  
	   	   	  dump 204  	  '  |  Opening Balances  -  Dimension  /  Ledger  /  Currency  
	   	  end if  
	  end if  
	  if var.DimensionType8Used  >  1 then '  |  value 1 is "not used"  	   
	   	  var.code8  =  get.dimension.mapping(OpeningBalance.DimCodeSource8)  	   
	   	  var.dtyp  =  8  
	   	  var.dimx  =  var.code8  
	   	  if var.dimx  <>  "" then  
	   	   	  '  |  Dump 204 dimx record if dimx has a value  
	   	   	  dump 204  	  '  |  Opening Balances  -  Dimension  /  Ledger  /  Currency  
	   	  end if  
	  end if  
	  if var.DimensionType9Used  >  1 then '  |  value 1 is "not used"  
	   	  var.code9  =  get.dimension.mapping(OpeningBalance.DimCodeSource9)  	   
	   	  var.dtyp  =  9  
	   	  var.dimx  =  var.code9  
	   	  if var.dimx  <>  "" then  
	   	   	  '  |  Dump 204 dimx record if dimx has a value  
	   	   	  dump 204  	  '  |  Opening Balances  -  Dimension  /  Ledger  /  Currency  
	   	  end if  
	  end if  
	  if var.DimensionType10Used  >  1 then '  |  value 1 is "not used"  
	   	  var.code10  =  get.dimension.mapping(OpeningBalance.DimCodeSource10)  	   
	   	  var.dtyp  =  10  
	   	  var.dimx  =  var.code10  
	   	  if var.dimx  <>  "" then  
	   	   	  '  |  Dump 204 dimx record if dimx has a value  
	   	   	  dump 204  	  '  |  Opening Balances  -  Dimension  /  Ledger  /  Currency  
	   	  end if  
	  end if  
	  if var.DimensionType11Used  >  1 then '  |  value 1 is "not used"  	   
	   	  var.code11  =  get.dimension.mapping(OpeningBalance.DimCodeSource11)  	   
	   	  var.dtyp  =  11  
	   	  var.dimx  =  var.code11  
	   	  if var.dimx  <>  "" then  
	   	   	  '  |  Dump 204 dimx record if dimx has a value  
	   	   	  dump 204  	  '  |  Opening Balances  -  Dimension  /  Ledger  /  Currency  
	   	  end if  
	  end if  
	  if var.DimensionType12Used  >  1 then '  |  value 1 is "not used"  	   
	   	  var.code12  =  get.dimension.mapping(OpeningBalance.DimCodeSource12)  	   
	   	  var.dtyp  =  12  
	   	  var.dimx  =  var.code12  
	   	  if var.dimx  <>  "" then  
	   	   	  '  |  Dump 204 dimx record if dimx has a value  
	   	   	  dump 204  	  '  |  Opening Balances  -  Dimension  /  Ledger  /  Currency  
	   	  end if  
	  end if  
	   
	   
	  '  |  For each record in the opening balance a record for tfgld206 is dumped.  
	  var.dims  =  Mid(var.code6, 1,9)  &  Mid(var.code7,1,9)  &  Mid(var.code8,1,9)  &  Mid(var.code9,1,9)  &  Mid(var.code10,1,9)  &  Mid(var.code11,1,9)  &  Mid(var.code12,1,9)  
	  dump 206  	  '  |  Opening Balances  -  Combination of Dimension  /  Ledger  /  Currency  
	   
	  '  |  For dumping record for tfgld203 the OpeningBalnce records need to be sumarized per  
	  '  |  FiscalYear  &  AccountSource.  
	   
	  if (varint.FiscalYear  <>  OpeningBalance.FiscalYear or varstr.AccountSource  <>  OpeningBalance.AccountSource) then  
	   	   	   
	   	  '  |  Dump sumarized values previous combination FiscalYear  /  AccountSource  
	   	  '  |  but skip the first pass  
	   	  if varstr.AccountSource  <>  "" then  
	   	   	  dump 203  	  '  |  Opening Balances  -  Ledger  /  Curr  
	   	  end if  
	   	   
	   	  var.tot.transaction.balance  =  0  
	   	  var.tot.BC1.balance  =  0  
	   	  var.tot.BC2.balance  =  0  
	   	  var.tot.BC3.balance  =  0  
	   	  var.tot.qty1.balance  =  0  
	   	  var.tot.qty2.balance  =  0  
	   	  varint.FiscalYear  =  OpeningBalance.FiscalYear  
	   	  varstr.AccountSource  =  OpeningBalance.AccountSource  
	  end if  
	   	  var.tot.transaction.balance  =  var.tot.transaction.balance  +  OpeningBalance.Amount  
	   	  var.tot.BC1.balance  =  var.tot.BC1.balance  +  var.opening.balance1  
	   	  var.tot.BC2.balance  =  var.tot.BC2.balance  +  var.opening.balance2  
	   	  var.tot.BC3.balance  =  var.tot.BC3.balance  +  var.opening.balance3  
	   	  var.tot.qty1.balance  =  var.tot.qty1.balance  +  OpeningBalance.Quantity1  
	   	  var.tot.qty2.balance  =  var.tot.qty2.balance  +  var.finalized.qty2  
	   	  var.dump.last.record  =  1
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:206
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpeningBalance
:ICOD:S
:QURY:START
select OpeningBalance.*
from OpeningBalance
order by OpeningBalance.FiscalYear, OpeningBalance.AccountSource
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tf
:TCMOD:gld
:TFLNO:206
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpeningBalance
:ICOD:X
:QURY:START
'Moved to PreCondition section.  
'if var.dump.last.record  =  1 then  
'  	  '  |  Dump the totalized values of the last combination FiscalYear  /  AccountSource.  	   
'  	  dump 203  	  '  |  Opening Balances  -  Ledger  /  Curr  
'end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:D
:QURY:START
	  var.tibom010.indt  =  get.utc(BillOfMaterial.EffectiveDate,"yes")  
	  'var.tibom010.exdt  =  get.utc(BillOfMaterial.ExpiryDate,"no")  	   	   
	  If BillOfMaterial.ExpiryDate  =  "" or IsNull(BillOfMaterial.ExpiryDate) then  	   
	   	  var.tibom010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tibom010.exdt  =  get.utc(BillOfMaterial.ExpiryDate,"no")  
	  end if  
	  dump 010 '  |  tibom010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:S
:QURY:START
select BillOfMaterial.*
from BillOfMaterial
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:bom
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ReferenceDesignatorByBOM
:ICOD:D
:QURY:START
dump 020
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:bom
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ReferenceDesignatorByBOM
:ICOD:S
:QURY:START
select ReferenceDesignatorByBOM.*
from ReferenceDesignatorByBOM
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:bom
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ReferenceDesignatorByBOM
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:bom
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaterialRoutingRelationships
:ICOD:D
:QURY:START
dump 040
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:bom
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaterialRoutingRelationships
:ICOD:S
:QURY:START
select MaterialRoutingRelationships.*
from MaterialRoutingRelationships
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:bom
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaterialRoutingRelationships
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:bom
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AlternativeMaterial
:ICOD:D
:QURY:START
dump 050
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:bom
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AlternativeMaterial
:ICOD:S
:QURY:START
select AlternativeMaterial.*
from AlternativeMaterial
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:bom
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AlternativeMaterial
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:cpr
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSurcharges
:ICOD:D
:QURY:START
	  dump 110
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:cpr
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSurcharges
:ICOD:S
:QURY:START
select ItemSurcharges.*
from ItemSurcharges
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:cpr
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSurcharges
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:D
:QURY:START
	  if Projects.btco  =  1 then  
	   	  var.tppdm600.cmog  =  2  
	  else  
	   	  var.tppdm600.cmog  =  3  
	  end if  
	  if Projects.intp  =  1 then  
	   	  var.tppdm600.ipin  =  2  
	  else  
	   	  var.tppdm600.ipin  =  1  
	  end if  
	  var.tppdm600.rate  =  Projects.rate  
	  if trim(var.tppdm600.rate)  =  "" or IsNull(var.tppdm600.rate) then  
	   	  var.tppdm600.rate  =  1  
	  end if  
	  dump 600  
	  dump 113  
	  dump 610
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:S
:QURY:START
select Projects.*
from Projects
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:D
:QURY:START
	  varstr.address  =  WorkCenter.Address  
	  select Addresses.City  
	  from  	  Addresses  
	  where Addresses.AddressCode  =  varstr.address  
	  selectdo  
	  endselect  
	   
	  var.tcmcs065.city  =  Left(Addresses.City, 8)  
	  dump 001  
	  dump 065  
	  dump 110  
	  dump 124  
	  dump 200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:S
:QURY:START
select WorkCenter.*
from WorkCenter
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingCodesByItem
:ICOD:D
:QURY:START
	  if RoutingCodesByItem.RoutingQuantity  =  "0" then  
	   	  var.tirou101.runi  =  "1"  
	  else  
	   	  var.tirou101.runi  =  RoutingCodesByItem.RoutingQuantity  
	  end if  
	   	   
dump 101
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingCodesByItem
:ICOD:S
:QURY:START
select RoutingCodesByItem.*
from RoutingCodesByItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingCodesByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:D
:QURY:START
'  |   *  ERP  -  00000  -  51389.sn  
	  var.cycletime  =  RoutingOperation.CycleTime  
	  varstr.cprj  =  RoutingOperation.ManufacturedProject  
	  varstr.item  =  RoutingOperation.ManufacturedItem  
	  varstr.routing  =  RoutingOperation.Routing  
	  var.quantity  =  0  
'  |   *  ERP  -  00000  -  51389.en  
	  If varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select RoutingCodesByItem.RoutingQuantity  
	   	  from  	  RoutingCodesByItem  
	   	  where RoutingCodesByItem.ManufacturedItem  =  varstr.item  
	   	  and  	  RoutingCodesByItem.Routing  =  varstr.routing  
	   	  selectdo  
	   	   	  If RoutingCodesByItem.ManufacturedProject  =  "" or IsNull(RoutingCodesByItem.ManufacturedProject) then  
	   	   	   	  var.quantity  =  RoutingCodesByItem.RoutingQuantity  
	   	   	  End If  
	   	  endselect  
	  else  
	   	  select RoutingCodesByItem.RoutingQuantity  
	   	  from  	  RoutingCodesByItem  
	   	  where RoutingCodesByItem.ManufacturedProject  =  varstr.cprj  
	   	  and  	  RoutingCodesByItem.ManufacturedItem  =  varstr.item  
	   	  and  	  RoutingCodesByItem.Routing  =  varstr.routing  
	   	  selectdo  
	   	   	  var.quantity  =  RoutingCodesByItem.RoutingQuantity  
	   	  endselect  
	  End If  
'  |   *  ERP  -  00000  -  51389.sn  
	  if var.cycletime  >  "0" then  
	   	  if var.quantity  =  "0" then  
'  |  243218.o  	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime) ,2)  
	   	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime) ,2,0,0,0) '  |  243218.n  
	   	  else  
'  |  243218.o  	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime)  *  Cdbl(var.quantity) ,2)  
	   	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime)  *  Cdbl(var.quantity) ,2,0,0,0) '  |  243218.n  
	   	  end if  
	  else  
	   	  var.tirou102.prte  =  0  
	  end if  
'  |   *  ERP  -  00000  -  51389.en  
	  var.tirou102.indt  =  get.utc(RoutingOperation.EffectiveDate,"yes")  
	  If RoutingOperation.ExpiryDate  =  "" or IsNull(RoutingOperation.ExpiryDate)then  	   
	   	  var.tirou102.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tirou102.exdt  =  get.utc(RoutingOperation.ExpiryDate,"yes")  
	  end if  	   
	  dump 102 '  |  tirou102
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:S
:QURY:START
select RoutingOperation.*
from RoutingOperation
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:103
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PhantomRoutingRelationship
:ICOD:D
:QURY:START
	  dump 103
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:103
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PhantomRoutingRelationship
:ICOD:S
:QURY:START
select PhantomRoutingRelationship.*
from PhantomRoutingRelationship
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:ti
:TCMOD:rou
:TFLNO:103
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PhantomRoutingRelationship
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:015
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardLabors
:ICOD:D
:QURY:START
	  if CDbl(StandardLabors.ratc)  >  0 then  
	   	  var.tppdm015.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm015.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardLabors.rats)  >  0 then  
	   	  var.tppdm015.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm015.ltrs  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:015
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardLabors
:ICOD:S
:QURY:START
select StandardLabors.*
from StandardLabors
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:015
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardLabors
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:016
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TradeGroups
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:016
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TradeGroups
:ICOD:S
:QURY:START
select TradeGroups.*
from TradeGroups
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:016
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TradeGroups
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:D
:QURY:START
	  if CDbl(StandardEquipments.ratc)  >  0 then  
	   	  var.tppdm025.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardEquipments.rats)  >  0 then  
	   	  var.tppdm025.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrs  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardEquipments.ratp)  >  0 then  
	   	  var.tppdm025.ltrp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:S
:QURY:START
select StandardEquipments.*
from StandardEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:D
:QURY:START
	  if CDbl(StandardSubcontractings.pric)  >  0 then  
	   	  var.tppdm035.ltpc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltpc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSubcontractings.pris)  >  0 then  
	   	  var.tppdm035.ltps  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltps  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSubcontractings.prip)  >  0 then  
	   	  var.tppdm035.ltpp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltpp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:S
:QURY:START
select StandardSubcontractings.*
from StandardSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSundryCosts
:ICOD:D
:QURY:START
	  if CDbl(StandardSundryCosts.pric)  >  0 then  
	   	  var.tppdm040.ltcp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm040.ltcp  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSundryCosts.pris)  >  0 then  
	   	  var.tppdm040.ltsp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm040.ltsp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSundryCosts
:ICOD:S
:QURY:START
select StandardSundryCosts.*
from StandardSundryCosts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSundryCosts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:049
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesByResponsibility
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:049
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesByResponsibility
:ICOD:S
:QURY:START
select EmployeesByResponsibility.*
from EmployeesByResponsibility
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:049
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesByResponsibility
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:090
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardElements
:ICOD:D
:QURY:START
	  var.prin  =  StandardElements.prin  
	  '  |  Condition for field 'Progress for Invoice'  
	  var.cspt  =  StandardElements.cspt  
	  if var.prin  =  3 then  	  '  |  Project Physical Progress  
	   	  var.cspt  =  2  	  '  |  Indirect  
	  end if  
	  if var.prin  =  4 then  	  '  |  Not Applicable  
	   	  var.cspt  =  3  	  '  |  Not Applicable  
	  end if  
	  '  |  Condition for field 'To Be Settled'  
	  var.setl  =  2  
	  if var.prin  =  1 then  
	   	  var.setl  =  StandardElements.setl  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:090
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardElements
:ICOD:S
:QURY:START
select StandardElements.*
from StandardElements
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:090
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardElements
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardActivities
:ICOD:D
:QURY:START
	  var.prin  =  StandardActivities.prin  
	  '  |  Determine 'Progress for Invoice'  
	  var.cspt  =  StandardActivities.cspt  
	  if var.prin  =  3 then  	  '  |  Project Physical Progress  
	   	  var.cspt  =  2  	  '  |  Indirect  
	  end if  
	  if var.prin  =  4 then  	  '  |  Not Applicable  
	   	  var.cspt  =  3  	  '  |  Not Applicable  
	  end if  
	  '  |  Determine 'To Be Settled'  
	  var.setl  =  2  
	  if var.prin  =  1 then  
	   	  var.setl  =  StandardActivities.setl  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardActivities
:ICOD:S
:QURY:START
select StandardActivities.*
from StandardActivities
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardActivities
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:139
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardActivitiesRevenueCodes
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:139
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardActivitiesRevenueCodes
:ICOD:S
:QURY:START
select StandardActivitiesRevenueCodes.*
from StandardActivitiesRevenueCodes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:139
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardActivitiesRevenueCodes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProgressInvoicingActivitiesRevenueCodes
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProgressInvoicingActivitiesRevenueCodes
:ICOD:S
:QURY:START
select ProgressInvoicingActivitiesRevenueCodes.*
from ProgressInvoicingActivitiesRevenueCodes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProgressInvoicingActivitiesRevenueCodes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:141
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardElementsRevenueCodes
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:141
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardElementsRevenueCodes
:ICOD:S
:QURY:START
select StandardElementsRevenueCodes.*
from StandardElementsRevenueCodes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:141
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardElementsRevenueCodes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:142
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProgressInvoicingElementsRevenueCodes
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:142
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProgressInvoicingElementsRevenueCodes
:ICOD:S
:QURY:START
select ProgressInvoicingElementsRevenueCodes.*
from ProgressInvoicingElementsRevenueCodes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:142
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProgressInvoicingElementsRevenueCodes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:153
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaterialPriceFluctuationsIndexTables
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:153
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaterialPriceFluctuationsIndexTables
:ICOD:S
:QURY:START
select MaterialPriceFluctuationsIndexTables.*
from MaterialPriceFluctuationsIndexTables
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:153
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaterialPriceFluctuationsIndexTables
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:S
:QURY:START
select  	  StandardSurchargesGeneralAndByCostType.*
from 	  StandardSurchargesGeneralAndByCostType
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:171
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByCostComponent
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:171
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByCostComponent
:ICOD:S
:QURY:START
select StandardSurchargesByCostComponent.*
from StandardSurchargesByCostComponent
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:171
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByCostComponent
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:172
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByMaterial
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:172
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByMaterial
:ICOD:S
:QURY:START
select StandardSurchargesByMaterial.*
from StandardSurchargesByMaterial
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:172
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByMaterial
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:173
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByLabor
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:173
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByLabor
:ICOD:S
:QURY:START
select StandardSurchargesByLabor.*
from StandardSurchargesByLabor
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:173
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByLabor
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:174
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByEquipment
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:174
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByEquipment
:ICOD:S
:QURY:START
select StandardSurchargesByEquipment.*
from StandardSurchargesByEquipment
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:174
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByEquipment
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:175
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySubcontracting
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:175
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySubcontracting
:ICOD:S
:QURY:START
select StandardSurchargesBySubcontracting.*
from StandardSurchargesBySubcontracting
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:175
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySubcontracting
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:176
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySundryCost
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:176
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySundryCost
:ICOD:S
:QURY:START
select StandardSurchargesBySundryCost.*
from StandardSurchargesBySundryCost
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:176
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySundryCost
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:601
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectCostControlLevels
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:601
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectCostControlLevels
:ICOD:S
:QURY:START
select ProjectCostControlLevels.*
from ProjectCostControlLevels
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:601
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectCostControlLevels
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:615
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectLabors
:ICOD:D
:QURY:START
	  if CDbl(ProjectLabors.ratc)  >  0 then  
	   	  var.tppdm615.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm615.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectLabors.rats)  >  0 then  
	   	  var.tppdm615.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm615.ltrs  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:615
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectLabors
:ICOD:S
:QURY:START
select ProjectLabors.*
from ProjectLabors
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:615
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectLabors
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:D
:QURY:START
	  if CDbl(ProjectEquipments.ratc)  >  0 then  
	   	  var.tppdm625.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectEquipments.rats)  >  0 then  
	   	  var.tppdm625.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrs  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectEquipments.ratp)  >  0 then  
	   	  var.tppdm625.ltrp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:S
:QURY:START
select ProjectEquipments.*
from ProjectEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:D
:QURY:START
	  if CDbl(ProjectSubcontractings.pric)  >  0 then  
	   	  var.tppdm635.ltpc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltpc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSubcontractings.pris)  >  0 then  
	   	  var.tppdm635.ltps  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltps  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSubcontractings.prip)  >  0 then  
	   	  var.tppdm635.ltpp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltpp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:S
:QURY:START
select ProjectSubcontractings.*
from ProjectSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:640
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSundryCostCodes
:ICOD:D
:QURY:START
	  if Cdbl(ProjectSundryCostCodes.pric)  >  0 then  
	   	  var.tppdm640.ltpr  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm640.ltpr  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSundryCostCodes.pris)  >  0 then  
	   	  var.tppdm640.ltsp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm640.ltsp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:640
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSundryCostCodes
:ICOD:S
:QURY:START
select ProjectSundryCostCodes.*
from ProjectSundryCostCodes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:640
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSundryCostCodes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:643
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectRevenues
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:643
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectRevenues
:ICOD:S
:QURY:START
select ProjectRevenues.*
from ProjectRevenues
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:643
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectRevenues
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:649
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesResponsibleByProject
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:649
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesResponsibleByProject
:ICOD:S
:QURY:START
select EmployeesResponsibleByProject.*
from EmployeesResponsibleByProject
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:649
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesResponsibleByProject
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:740
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectBusinessPartners
:ICOD:D
:QURY:START
	  var.tppdm740.rate  =  ProjectBusinessPartners.rate  
	  if trim(var.tppdm740.rate)  =  "" or IsNull(var.tppdm740.rate) then  
	   	  var.tppdm740.rate  =  1  
	  end if  
	  var.tppdm740.raca  =  ProjectBusinessPartners.raca  
	  if trim(var.tppdm740.raca)  =  "" or IsNull(var.tppdm740.raca) then  
	   	  var.tppdm740.raca  =  1  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:740
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectBusinessPartners
:ICOD:S
:QURY:START
select ProjectBusinessPartners.*
from ProjectBusinessPartners
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:740
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectBusinessPartners
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:741
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractAmountsByBusinessPartners
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:741
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractAmountsByBusinessPartners
:ICOD:S
:QURY:START
select ProjectContractAmountsByBusinessPartners.*
from ProjectContractAmountsByBusinessPartners
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:741
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractAmountsByBusinessPartners
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:750
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BuyFromItems
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:750
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BuyFromItems
:ICOD:S
:QURY:START
select BuyFromItems.*
from BuyFromItems
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:750
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BuyFromItems
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:751
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BuyFromBPFileLayouts
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:751
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BuyFromBPFileLayouts
:ICOD:S
:QURY:START
select BuyFromBPFileLayouts.*
from BuyFromBPFileLayouts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:751
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BuyFromBPFileLayouts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:752
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DiscountGroupsByBuyFrom
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:752
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DiscountGroupsByBuyFrom
:ICOD:S
:QURY:START
select DiscountGroupsByBuyFrom.*
from DiscountGroupsByBuyFrom
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:752
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DiscountGroupsByBuyFrom
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:754
:SCPAC:bc
:SCMOD:tbl
:SFLNO:UnitsByBuyFrom
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:754
:SCPAC:bc
:SCMOD:tbl
:SFLNO:UnitsByBuyFrom
:ICOD:S
:QURY:START
select UnitsByBuyFrom.*
from UnitsByBuyFrom
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:754
:SCPAC:bc
:SCMOD:tbl
:SFLNO:UnitsByBuyFrom
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:758
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsByBuyFromDiscountGroup
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:758
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsByBuyFromDiscountGroup
:ICOD:S
:QURY:START
select ItemsByBuyFromDiscountGroup.*
from ItemsByBuyFromDiscountGroup
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pdm
:TFLNO:758
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsByBuyFromDiscountGroup
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectPlans
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectPlans
:ICOD:S
:QURY:START
select ProjectPlans.*
from ProjectPlans
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectPlans
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Baselines
:ICOD:D
:QURY:START
	  if Baselines.crdt  =  "" or IsNull(Baselines.crdt) then  
	   	  var.tppss020.crdt  =  get.utc(date(),"yes")  
	  else  
	   	  var.tppss020.crdt  =  get.utc(Baselines.crdt,"yes")  
	  end if  
	  if (Baselines.apdt  =  "" or IsNull(Baselines.apdt)) and Baselines.bsta  =  2 then  
	   	  var.tppss020.apdt  =  get.utc(date(),"no")  
	  else  
	   	  var.tppss020.apdt  =  get.utc(Baselines.apdt,"no")  
	  end if  
	  if Baselines.lupd  =  "" or IsNull(Baselines.lupd) then  
	   	  var.tppss020.lupd  =  get.utc(date(),"yes")  
	  else  
	   	  var.tppss020.lupd  =  get.utc(Baselines.lupd,"yes")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Baselines
:ICOD:S
:QURY:START
select Baselines.*
from Baselines
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Baselines
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:D
:QURY:START
	  varstr.project  =  Activities.cprj  
	  var.btco  =  1  	   	   	   	  '  |  Default is 'Element'  
	  var.invm  =  3  	   	   	  '  |  Default is 'Installment'  
	  var.secu  =  ""  
	  var.prss  =  0.0000  
	  var.rtse.1  =  0.000000  
	  var.rtse.2  =  0.000000  
	  var.rtse.3  =  0.000000  
	  var.rfse.1  =  0  
	  var.rfse.2  =  0  
	  var.rfse.3  =  0  
	  var.prin  =  4  	   	   	   
	  var.cspt  =  3  	   	   	   
	  var.setl  =  2  
	  var.gris  =  0  
	  select Projects.invm,  
	   	  Projects.btco  
	  from  	  Projects  
	  where Projects.cprj  =  varstr.project  
	  selectdo  
	   	  var.invm  =  Projects.invm  	  '  |  Invoice Type  
	   	  var.btco  =  Projects.btco  	  '  |  Control By  
	  endselect  
	  '  |  Check if 'Invoice Type'  =  Progress Invoice and 'Control By'  =  Activity  	   
	  if var.invm  =  4 and var.btco  =  2 then  	   	   
	   	  var.secu  =  Activities.secu  
	   	  var.prss  =  Activities.prss  
	   	  var.rtse.1  =  Activities.rtse  
	   	  var.rtse.2  =  0.000001  
	   	  var.rtse.3  =  0.000001  
	   	  var.rfse.1  =  Activities.rfse  
	   	  var.rfse.2  =  1  
	   	  var.rfse.3  =  1  
	   	  var.prin  =  Activities.prin  
	   	  '  |  Determine field 'Progress for Invoice'  
	   	  if var.prin  =  3 then  
	   	   	  var.cspt  =  2 '  |  Indirect  
	   	  end if  
	   	  '  |  Determine field 'To Be Settled'  
	   	  if var.prin  =  1 and var.cspt  =  1 then  
	   	   	  var.setl  =  Activities.setl  
	   	  end if  
	   	  if var.prin  =  2 and var.cspt  =  1 then  
	   	   	  var.setl  =  Activities.setl  
	   	  end if  
	   	  '  |  Determine field 'Group Indirect Work'  
	   	  if var.prin  =  1 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	   	  if var.prin  =  2 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	   	  if var.prin  =  3 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	  end if  
	  '  |  In case Actual Finish Date is filled the Actual Start Date must be empty  !   
	  var.asdt  =  Activities.asdt  
	  if trim(Activities.afdt)  <>  "" then  
	   	  var.asdt  =  ""  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:S
:QURY:START
select Activities.*
from Activities
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ActivityBaseline
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ActivityBaseline
:ICOD:S
:QURY:START
select ActivityBaseline.*
from ActivityBaseline
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ActivityBaseline
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:230
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ExternalScheduleLinks
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:230
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ExternalScheduleLinks
:ICOD:S
:QURY:START
select ExternalScheduleLinks.*
from ExternalScheduleLinks
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:pss
:TFLNO:230
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ExternalScheduleLinks
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:S
:QURY:START
select Extensions.*
from Extensions
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:D
:QURY:START
	  var.prin  =  Elements.prin  
	  '  |  Condition for field 'Progress for Invoice'  
	  var.cspt  =  Elements.cspt  
	  if var.prin  =  2 then  	  '  |  No  
	   	  var.cspt  =  3  	  '  |  Not Applicable  
	  end if  
	  if var.prin  =  3 then  	  '  |  Project Physical Progress  
	   	  var.cspt  =  2  	  '  |  Indirect  
	  end if  
	  '  |  Condition for field 'To Be Settled'  
	  var.setl  =  2  
	  if var.prin  =  1 and var.cspt  =  1 then  
	   	  var.setl  =  Elements.setl  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:S
:QURY:START
select Elements.*
from Elements
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:ptc
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ElementRelations
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:ptc
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ElementRelations
:ICOD:S
:QURY:START
select ElementRelations.*
from ElementRelations
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:tp
:TCMOD:ptc
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ElementRelations
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:inh
:TFLNO:520
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AdjustmentOrders
:ICOD:D
:QURY:START
	  varstr.cwar  =  AdjustmentOrders.Warehouse  
	  varstr.item  =  AdjustmentOrders.Item  
	  varstr.cprj  =  AdjustmentOrders.Project  
	  varstr.temp  =  read.item.settings(varstr.item, varstr.cprj, var.location.controlled, var.lot.controlled, var.serialized, var.lots.in.inv, var.serials.in.inv)  
	  If AdjustmentOrders.Warehouse  <>  prev.warehouse then  
	   	  varint.position  =  10  
	   	  varint.counter  =  varint.counter  +  1  
	   	  varstr.order.number  =  generate.order.number(varstr.series, varint.counter)  
	   	  dump 520 '  |  Adjustment Order Headers  
	  End If  
	  '  |   *  The 'Inventory Price' check box is only available if both of the following conditions apply:  
	   	  '  |  1  -  The adjustment  -  order line concerns a positive variance.  
	   	  '  |  2  -  The item's inventory  -  valuation method is not 'Fixed Transfer Price (FTP)' (whwmd210.valm).  
	  varint.valm  =  get.inventory.valuation.method(varstr.cwar, varstr.cprj, varstr.item)  
	  if varint.valm  <>  1 then  
	   	  var.adjustment.price  =  AdjustmentOrders.AdjustmentPrice  
	  else  
	   	  var.adjustment.price  =  0  
	  end if  
	  if var.adjustment.price  =  0 or IsNull(var.adjustment.price) then  
	   	  var.use.price  =  2  	  '  |  No  
	  else  
	   	  var.use.price  =  1  	  '  |  Yes  
	  end if  
	  '  |   *  Determine if Location is permitted for this item  
	  varstr.location  =  AdjustmentOrders.Location  
	  if var.location.controlled  =  2 then  
	   	  varstr.location  =  ""  
	  end if  
	  '  |   *  Determine if Lot is permitted for this item  
	  '  |   *  The field 'Lots in Inventory' (whwmd400.linv) is always set to "yes" in case of a Lot Controlled item.  
	  '  |   *  That means it is mandatory to fill a Lot in whinh521  !   
	  varstr.clot  =  AdjustmentOrders.Lot  
	  if var.lot.controlled  =  2 then  	   
	   	  var.whinh521.clot  =  ""  
	  else  
	   	  var.whinh521.clot  =  varstr.clot  	   	   
	  end if  
	  '  |  Ownership variables non  -  serialized items  
	  var.whinh521.istr  =  90 '  |  Not Applicable  
	  var.whinh521.iown  =  90 '  |  Not Applicable  
	  var.whinh521.dpby  =  90 '  |  Not Applicable  
	  varstr.serial  =  AdjustmentOrders.SerialNumber  
	  if var.serialized  =  1 and trim(varstr.serial)  <>  "" then  
	   	  '  |   *  The Lot field in table whinh526 (Adjustment Order Line Lots and Serials) is only applicable in case the setting 'Lots in Inventory' is not set (whwmd400.linv)  !   
	   	  '  |   *  In case of a Serialized item you have to enter the serial numbers (must be unique  !  ) in table whinh526.  
	   	  if var.lots.in.inv  =  1 then  
	   	   	  var.whinh521.clot  =  varstr.clot  
	   	   	  var.whinh526.clot  =  ""  
	   	  else  
	   	   	  var.whinh521.clot  =  ""  
	   	   	  var.whinh526.clot  =  varstr.clot  
	   	  end if  
	   	  if var.serials.in.inv  =  1 then  
	   	   	  var.whinh526.stat  =  1  	  '  |  Initial  
	   	  else  	   
	   	   	  var.whinh526.stat  =  20  	  '  |  Not Applicable  
	   	  end if  
	   	   
	   	  if (varstr.cwar  =  prev.warehouse) and (varstr.cprj  <>  prev.project or varstr.item  <>  prev.item) then  
	   	   	  var.quantity  =  determine.total.line.quantity(varstr.cwar, varstr.cprj, varstr.item)  
	   	   	  if var.serials.in.inv  =  1 then  
	   	   	   	  var.whinh521.istr  =  10 '  |  Free  
	   	   	   	  var.whinh521.iown  =  10 '  |  Company Owned or Consigned  
	   	   	   	  var.whinh521.dpby  =  20 '  |  Own Company  
	   	   	  end if  
	   	   	  varint.position  =  varint.position  +  10  
	   	   	  dump 521 '  |  Adjustment Order Line  
	   	  end if  
	   	  if varint.position  =  prev.position then  
	   	   	  var.whinh526.dssq  =  var.whinh526.dssq  +  1  
	   	  else  
	   	   	  var.whinh526.dssq  =  1  
	   	  end if  
	   	  dump 526 '  |  Adjustment Order Line Lots and Serials  
	  else  
	   	  var.quantity  =  AdjustmentOrders.Quantity  
	   	  If AdjustmentOrders.Warehouse  =  prev.warehouse then  
	   	   	  varint.position  =  varint.position  +  10  
	   	  End If  
	   	  if var.lots.in.inv  =  2 and var.lot.controlled  =  1 and trim(varstr.clot)  <>  "" then  
	   	   	  '  |  When 'Lots in inventory' is 'no' and items is not serialized then always 1 line in whinh526 to register the lot  
	   	   	  '  |  and the Lot field in whinh521 must be empty.  
	   	   	  var.whinh521.clot  =  ""  
	   	   	  var.whinh526.clot  =  varstr.clot  
	   	   	  var.whinh526.stat  =  20  
	   	   	  var.whinh526.dssq  =  1  
	   	   	  dump 526 '  |  Adjustment Order Line Lots and Serials  
	   	  end if  
	   	  dump 521 '  |  Adjustment Order Line  
	  end if  
	  prev.warehouse  	   =  AdjustmentOrders.Warehouse  
	  prev.project  	   =  AdjustmentOrders.Project  
	  prev.item  	   	   =  AdjustmentOrders.Item  
	  prev.position  	   =  varint.position  
	  '  |   *  COMMENTS  
	  '  |   *  It is not necessary to fill table whinh525 (Adjustment Order Line Ownership)  
	  '  |   *  because this table will be automatically filled by the system as soon as the adjustment orders will be processed.  
	
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:inh
:TFLNO:520
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AdjustmentOrders
:ICOD:S
:QURY:START
select AdjustmentOrders.*
from 	  AdjustmentOrders
order by AdjustmentOrders.Warehouse, AdjustmentOrders.Project, AdjustmentOrders.Item, AdjustmentOrders.Lot, AdjustmentOrders.SerialNumber
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:inh
:TFLNO:520
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AdjustmentOrders
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:D
:QURY:START
	  var.whltc100.ldat  =  LotsByItem.LotDate  
	  if var.whltc100.ldat  =  "" or IsNull(var.whltc100.ldat) then  
	   	  var.whltc100.ldat  =  Date()  
	  end if  
	  dump 100 '  |  Lots
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:S
:QURY:START
select  	  LotsByItem.*
from 	  LotsByItem
order by LotsByItem.Project, LotsByItem.Item, LotsByItem.Lot
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:104
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StorageConditionsByItemGroupsItem
:ICOD:D
:QURY:START
	  dump 104
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:104
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StorageConditionsByItemGroupsItem
:ICOD:S
:QURY:START
select StorageConditionsByItemGroupsItem.*
from StorageConditionsByItemGroupsItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:104
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StorageConditionsByItemGroupsItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:D
:QURY:START
	  varstr.cprj  =  WarehouseItem.Project  
	  varstr.item  =  WarehouseItem.Item  
	  var.whwmd210.ialt  =  20  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select Items.LocationControlled  
	   	  from Items  
	   	  where Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  If Items.Project  =  "" or IsNull(Items.Project) then  
	   	   	   	  If Items.LocationControlled  =  1 then  
	   	   	   	   	  var.whwmd210.ialt  =  5  
	   	   	   	  else  
	   	   	   	   	  var.whwmd210.ialt  =  20  
	   	   	   	  End If  
	   	   	  End If  
	   	  endselect  
	  else  
	   	  select Items.LocationControlled  
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj  
	   	  and  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  if Items.LocationControlled  =  1 then  
	   	   	   	  var.whwmd210.ialt  =  5  
	   	   	  else  
	   	   	   	  var.whwmd210.ialt  =  20  
	   	   	  end if  
	   	  endselect  
	  end if  
	   
	  if (WarehouseItem.OrderQuantityIncrement  <=  "0") then  
	   	  var.oqmf  =  1  
	  else  
	   	  var.oqmf  =  WarehouseItem.OrderQuantityIncrement  
	  end if  
	  if (WarehouseItem.MinimumOrderQuantity  <=  "0") then  
	   	  var.mioq  =  1  
	  else  
	   	  var.mioq  =  WarehouseItem.MinimumOrderQuantity  
	  end if  
	  if (WarehouseItem.MaximumOrderQuantity  <=  "0") then  
	   	  var.maoq  =  9999999  
	  else  
	   	  var.maoq  =  WarehouseItem.MaximumOrderQuantity  
	  end if  
	  if (WarehouseItem.FixedOrderQuantity  <=  "0") then  
	   	  var.fioq  =  1  
	  else  
	   	  var.fioq  =  WarehouseItem.FixedOrderQuantity  
	  end if  
'  	  if (Warehouse_Item.EconomicOrderQuantity  <=  "0") then  	   |   #  253844.so  
'  	   	  var.ecoq  =  1  
'  	  else  
'  	   	  var.ecoq  =  Warehouse_Item.EconomicOrderQuantity  
'  	  end if  	   	   	   	   	   	   	   |   #  253844.eo  
	  if (WarehouseItem.EconomicOrderQuantity  <=  "0") then  	  '  |   #  253844.sn  
	   	  var.ecoq  =  1  
	  else  
	   	  var.ecoq  =  WarehouseItem.EconomicOrderQuantity  
	  end if  
	   	   	   	   	   	   	  '  |   #  253844.en  
	  var.whwmd210.srpr  =  2  
	  if (WarehouseItem.InventoryValuationMethod)  =  6 then  
	   	  var.whwmd210.srpr  =  1  
	  end if  
	  dump 210  	  '  |   *  whwmd210  -  Warehouse Item Data  
	  dump 215  	  '  |   *  whwmd215  -  Item Inv by Warehouse  
	  dump 216  	  '  |   *  whwmd216  -  Inv by warehouse, item , eff unit
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:S
:QURY:START
select  	  WarehouseItem.*
from 	  WarehouseItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DockLocationsByWarehouseStorageZone
:ICOD:D
:QURY:START
'  |   	  Call DetermineShipFromToBusinessPartner(_  	   	   	  '  |   #  249610.so  
'  |   	   	  DockLocationsByWarehouseStorageZone.DockType,_  
'  |   	   	  DockLocationsByWarehouseStorageZone.BusinessPartner)  
	   	   	   	   	   	   	   	   	  '  |   #  249610.eo  
'  |  KH20110804.so  
'  |   	   	   	   	   	   	   	   	   	  '  |   #  249610.sn  
'  |   	  Call DetermineShipFromToBusinessPartner(_  
'  |   	   	  DockLocationsByWarehouseStorageZone.DockType,_  
'  |   	   	  DockLocationsByWarehouseStorageZone.BusinessPartner,_  
'  |   	   	  var.whwmd220.sfty,_  
'  |   	   	  var.whwmd220.sfco,_  
'  |   	   	  var.whwmd220.stty,_  	   
'  |   	   	  var.whwmd220.stco)  
'  |   	   	   	   	   	   	   	   	   	  '  |   #  249610.en  
'  |  KH20110804.eo.sn  
	  '  |  initialize  
	  var.whwmd220.sfty  =  10  	   	  '  |  Not aplicable  
	  var.whwmd220.sfco  =  ""  
	  var.whwmd220.stty  =  10  	   	  '  |  Not aplicable  
	  var.whwmd220.stco  =  ""  
	  varstr.DockType  =  DockLocationsByWarehouseStorageZone.DockType  
	  varstr.BusinessPartner  =  DockLocationsByWarehouseStorageZone.BusinessPartner  
	  If Trim(varstr.BusinessPartner)  <>  "" then  
	   	  If varstr.DockType  =  3 then  	   	  '  |  Receiving  
	   	   	  var.whwmd220.sfty  =  2  	   	   	   	   	  '  |  Business Partner  
	   	   	  var.whwmd220.sfco  =  Trim(varstr.BusinessPartner)  
	   	   	  var.whwmd220.stty  =  10  	   	   	   	   	  '  |  Not aplicable  	   
	   	   	  var.whwmd220.stco  =  ""  	   
	   	  End If  
	   	  If varstr.DockType  =  6 then  	   	  '  |  Staging  
	   	   	  var.whwmd220.sfty  =  10  	   	   	   	   	  '  |  Not aplicable  	   	   	   
	   	   	  var.whwmd220.sfco  =  ""  
	   	   	  var.whwmd220.stty  =  2  	   	   	   	   	  '  |  Business Partner  	   
	   	   	  var.whwmd220.stco  =  Trim(varstr.BusinessPartner)  	   
	   	  End If  
	  End If  
'  |  KH.en  
dump 220
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DockLocationsByWarehouseStorageZone
:ICOD:S
:QURY:START
select DockLocationsByWarehouseStorageZone.*
from DockLocationsByWarehouseStorageZone
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DockLocationsByWarehouseStorageZone
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Locations
:ICOD:D
:QURY:START
'  *  SL244251.sn  
	  varstr.loc  =  Locations.Location  
	  varlng.fixed.loc  =  2  
	  select  	  LocationByItem.Location  
	  from  	   	  LocationByItem  
	  where  	  LocationByItem.Location  =  varstr.loc  
	  group by  	  LocationByItem.Location  
	  selectdo  
	   	  varlng.fixed.loc  =  1  
	  endselect  
'  |   *  SL244251.en  
	  varstr.cwar  =  Locations.Warehouse  
	  var.whwmd300.inca  =  get.infinite.location(varstr.cwar, varstr.loc)  
	  dump 300 '  |  whwmd300
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Locations
:ICOD:S
:QURY:START
select Locations.*
from Locations
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Locations
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LocationCapacity
:ICOD:D
:QURY:START
	  dump 301
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LocationCapacity
:ICOD:S
:QURY:START
select LocationCapacity.*
from LocationCapacity
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LocationCapacity
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:302
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LocationByItem
:ICOD:D
:QURY:START
dump 302
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:302
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LocationByItem
:ICOD:S
:QURY:START
select LocationByItem.*
from LocationByItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:7
:VERS:A2LN
:RELE:a7
:CUST:FP7R
:TCPAC:wh
:TCMOD:wmd
:TFLNO:302
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LocationByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:D
:QURY:START
	  var.bpmdm001.sdte  =  get.date(EmployeesPeople.FirstDateEmployment,"yes")  
	  var.bpmdm001.edte  =  get.date(EmployeesPeople.LastDateEmployment,"no")  
	  var.bpmdm001.daob  =  get.date(EmployeesPeople.DateBirth,"no")  
	  dump 001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:S
:QURY:START
select EmployeesPeople.*
from EmployeesPeople
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:cp
:TCMOD:rpd
:TFLNO:320
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfCriticalMaterials
:ICOD:D
:QURY:START
	  var.cprpd320.indt  =  get.utc(BillOfCriticalMaterials.EffectiveDate, "yes")  
	  var.cprpd320.exdt  =  get.utc(BillOfCriticalMaterials.ExpiryDate, "no")  
'  |   
'  |  Sequence number can now be filled via the Access table  	   
'  	  If Hold.PlanItem  =  BillOfCriticalMaterials.PlanItem then  
'  	   	  var.cprpd320.sern  =  var.cprpd320.sern  +  1  
'  	  else  
'  	   	  var.cprpd320.sern  =  1  
'  	  end if  	   
' Hold.PlanItem  =  BillOfCriticalMaterials.PlanItem  
'  |   
dump 320
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:cp
:TCMOD:rpd
:TFLNO:320
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfCriticalMaterials
:ICOD:S
:QURY:START
select BillOfCriticalMaterials.*
from BillOfCriticalMaterials
order by BillOfCriticalMaterials.PlanItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:cp
:TCMOD:rpd
:TFLNO:320
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfCriticalMaterials
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:D
:QURY:START
	  var.cprpd710.effd  =  get.utc(SourcingStrategies.EffectivityDate, "yes")  
	  var.cprpd710.expd  =  get.utc(SourcingStrategies.ExpiryDate, "no")  	   
dump 710
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:S
:QURY:START
select SourcingStrategies.*
from SourcingStrategies
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:com
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Employees
:ICOD:D
:QURY:START
dump 001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:com
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Employees
:ICOD:S
:QURY:START
select Employees.*
from Employees
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:com
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Employees
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:D
:QURY:START
	  varstr.bp  =  BusinessPartner.BusinessPartner  
	  CustomerRoles  =  0  
	  SupplierRoles  =  0  
	  if BusinessPartner.SearchKey  <>  "" then  
	   	  var.tccom100.seak  =  UCase(Left(BusinessPartner.SearchKey,16))  
	  else  
	   	  var.tccom100.seak  =  UCase(Left(BusinessPartner.Name,16))  
	  end if  
	  var.tccom100.stdt  =  get.utc(BusinessPartner.StartDate, "no")  
	  if BusinessPartner.SoldTo  =  1 then  
	   	  CustomerRoles  =  1  
	   	  dump 110 '  |   #  tccom110  
	  end if  
	  if BusinessPartner.ShipTo  =  1 then  
	   	  if Trim(BusinessPartner.ShipToAddress)  <>  "" then  
	   	   	  varstr.address  =  BusinessPartner.ShipToAddress  
	   	  else  
	   	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  end if  
	   	  CustomerRoles  =  1  
	   	  dump 111 '  |   #  tccom111  
	  end if  
	  if BusinessPartner.InvoiceTo  =  1 then  
	   	  if Trim(BusinessPartner.InvoiceToAddress)  <>  "" then  
	   	   	  varstr.address  =  BusinessPartner.InvoiceToAddress  
	   	  else  
	   	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  end if  
	   	  CustomerRoles  =  1  
	   	  var.tccom112.edci  =  get.utc(BusinessPartner.ExpiryDateInsuredCredit,"no")  
	   	  dump 112 '  |   #  tccom112  
	  end if  
	  if BusinessPartner.PayBy  =  1 then  
	   	  CustomerRoles  =  1  
'  |  243210.sn  
	   	  var.tccom114.cban  =  ""  
	   	  select BankAccountsByPayByBP.*   
	   	  from BankAccountsByPayByBP  
	   	  where BankAccountsByPayByBP.PayByBusinessPartner  =  varstr.bp  
	   	  order by BankAccountsByPayByBP.BankAccountCode desc  
	   	  selectdo  
	   	   	  var.tccom114.cban  =  BankAccountsByPayByBP.BankAccountCode  
	   	  endselect  
'  |  243210.en  
	   	  dump 114 '  |   #  tccom114  
	  end if  
	  if BusinessPartner.BuyFrom  =  1 then  
	   	  SupplierRoles  =  1  
	   	  dump 120 '  |   #  tccom120  
	  end if  
	  if BusinessPartner.ShipFrom  =  1 then  
	   	  SupplierRoles  =  1  
	   	  dump 121 '  |   #  tccom121  
	  end if  
	  if BusinessPartner.InvoiceFrom  =  1 then  
	   	  SupplierRoles  =  1  
'  |  FP7.sn  	   	   
	   	  var.tccom122.cadr  =  BusinessPartner.AddressCode  
	   	  var.tccom122.rtyp  =  BusinessPartner.ExchangeRateType  
	   	  var.tccom122.crlr  =  BusinessPartner.CreditLimit  
	   	  if Not IsNull(BusinessPartner.CreditLimit) then  
	   	   	  var.tccom122.crlr  =  BusinessPartner.CreditLimit  
	   	  else  
	   	   	  var.tccom122.crlr  =  0.0  
	   	  end if  	   	   	   
	   	  var.tccom122.cpay  =  BusinessPartner.TermsPayment  
	   	  var.tccom122.ccrs  =  BusinessPartner.LatePaymentSurcharge  
	   	  var.tccom122.paym  =  BusinessPartner.PaymentMethod  
	   	  varstr.businesspartner  =  BusinessPartner.BusinessPartner  
	   	  select BusinessPartnerExtension.*   
	   	  from BusinessPartnerExtension  
	   	  where BusinessPartnerExtension.BusinessPartner  =  varstr.businesspartner  
	   	  selectdo  
	   	   	  if BusinessPartnerExtension.AddressCodeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.cadr  =  BusinessPartnerExtension.AddressCodeInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.ExchangeRateTypeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.rtyp  =  BusinessPartnerExtension.ExchangeRateTypeInvFrom  
	   	   	  end if  	   	   
	   	   	  if Not IsNull(BusinessPartnerExtension.CreditLimitInvFrom) then  
	   	   	   	  var.tccom122.crlr  =  BusinessPartnerExtension.CreditLimitInvFrom  
	   	   	  end if  	   	   
	   	   	  if BusinessPartnerExtension.TermsPaymentInvFrom  <>  "" then  
	   	   	   	  var.tccom122.cpay  =  BusinessPartnerExtension.TermsPaymentInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.LatePaymentSurchargeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.ccrs  =  BusinessPartnerExtension.LatePaymentSurchargeInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.PaymentMethodInvFrom  <>  "" then  
	   	   	   	  var.tccom122.paym  =  BusinessPartnerExtension.PaymentMethodInvFrom  
	   	   	  end if  
	   	  endselect  
|  FP7.en  
	   	  dump 122 '  |   #  tccom122  
	  end if  
	  if BusinessPartner.PayTo  =  1 then  
	   	  SupplierRoles  =  1  
'  |   *  Determine Bank Code  
'  |   *   #  42.sn  
	   	  var.tccom124.cban  =  ""  
	   	  select BankAccountsByPayToBP.*   
	   	  from  	  BankAccountsByPayToBP  
	   	  where BankAccountsByPayToBP.PayToBusinessPartner  =  varstr.bp  
	   	  order by BankAccountsByPayToBP.BankAccountCode desc  
	   	  selectdo  
	   	   	  var.tccom124.cban  =  BankAccountsByPayToBP.BankAccountCode  
	   	  endselect  
'  |   *   #  42.en  
	   	  dump 124 '  |   #  tccom124  
	  end if  
	  if CustomerRoles  =  0 then  
	   	  if SupplierRoles  =  0 then  
	   	   	  var.tccom100.bprl  =  1  
	   	  else  
	   	   	  var.tccom100.bprl  =  3  
	   	  end if  
	  else  
	   	  if SupplierRoles  =  0 then  
	   	   	  var.tccom100.bprl  =  2  
	   	  else  
	   	   	  var.tccom100.bprl  =  4  
	   	  end if  
	  end if  
	  dump 100 '  |   #  tccom100  
	  If BusinessPartner.TaxNumber  <>  "" then  
	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  var.tctax400.ccty  =  ""  
	   	  select  	  Addresses.*   
	   	  from  	  Addresses  
	   	  where  	  Addresses.AddressCode  =  varstr.address  
	   	  selectdo  
	   	   	  var.tctax400.ccty  =  Addresses.Country  
	   	  endselect  
	   	  dump 400 '  |   #  tctax400  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:S
:QURY:START
select  	  BusinessPartner.*
from 	  BusinessPartner
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:D
:QURY:START
	  if Addresses.SearchKey  <>  "" then  
	   	  var.tccom130.seak  =  Ucase(Left(Addresses.SearchKey,16))  
	  else  
	   	  var.tccom130.seak  =  Ucase(Left(Addresses.Name,16))  
	  end if  
'  |  Determine default messaging method  
'  |  SITA not used  
	  var.tccom130.defa  =  10  
'target(tccom.defa.not.applicable)  
	  if Addresses.SMSNumber  <>  "" then  
	   	  var.tccom130.defa  =  5 'to.target(tccom.defa.sms)  
	  end if  
	  if Addresses.Telex  <>  "" then  
	   	  var.tccom130.defa  =  3 ' to.target(tccom.defa.telex)  
	  end if  
	  if Addresses.Fax  <>  "" then  
	   	  var.tccom130.defa  =  2' to.target(tccom.defa.fax)  
	  end if  
	  if Addresses.Email  <>  "" then  
	   	  var.tccom130.defa  =  1 ' to.target(tccom.defa.email)  
	  end if  
	  if len(trim(Addresses.Telephone))  >  0 then  
	   	  var.tccom130.defa  =  6 ' to.target(tccom.defa.phone)  
	  end if  
'  |  end determine defa  
	  dump 130  
'  
	  if len(trim(Addresses.ZipPostalCode))  >  0 then  
	   	  if var.country  <>  trim(Addresses.Country) or _  
	   	  var.zipcode  <>  trim(Addresses.ZipPostalCode) then  
	   	   	  var.country  =  trim(Addresses.Country)  
	   	   	  var.zipcode  =  trim(Addresses.ZipPostalCode)  
	   	   	  dump 136  
	   	  end if  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:S
:QURY:START
select Addresses.*
from Addresses
order by Addresses.Country, Addresses.ZipPostalCode
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:D
:QURY:START
	  if trim(Contacts.SearchKey)  <>  "" then  
'  |   	   	  var.tccom140.seak  =  Ucase(Left(Contact.SearchKey,16)) '  |   *  249609.o  
	   	  var.tccom140.seak  =  Ucase(Left(Contacts.SearchKey,16)) '  |   *  249609.n  
	  else  
	   	  var.tccom140.seak  =  Ucase(Left(Contacts.FamilyName, 16))  
	  end if  
	   
	  var.tccom140.fuln  =  trim (Contacts.GivenName)  &  " "  &  trim(Contacts.MiddleName)  &  " "  &  trim(Contacts.FamilyName)  
	   
	  var.tccom140.bthd  =  get.date(Contacts.BirthDay,"no")  
	  var.tccom140.pelp  =  2  
	  var.tccom140.peld  =  2  
	  var.tccom140.pehm  =  2  
	  var.tccom140.pelm  =  2  
	  if trim (Contacts.Telephone)  <>  "" then  
	   	  var.tccom140.pelp  =  1 '  |  yes if Office phone filled  
	  else  
	   	  if trim (Contacts.Cellphone)  <>  "" then  
	   	   	  var.tccom140.pelm  =  1 '  |  yes If Mobile phone is filled  
	   	  else  
	   	   	  if trim (Contacts.PhonePrivate)  <>  "" then  
	   	   	   	  var.tccom140.pehm  =  1 '  |  yes If private phone is filled  
	   	   	  else  
	   	   	   	  if trim (Contacts.DirectDial)  <>  "" then  
	   	   	   	   	  var.tccom140.peld  =  1 '  |  yes If Direct Dial is filled  
	   	   	   	  end if  
	   	   	  end if  
	   	  end if  	   
	  end if  	   
	  dump 140  	  '  |   #  tccom140
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:S
:QURY:START
select Contacts.*
from Contacts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:D
:QURY:START
	  varstr.cprj  =  Items.Project  
	  varstr.item  =  Items.Item  
	  if Items.WeightUnit  =  "" then  
	   	  var.tcibd001.cwun  =  var.weight.unit  
	   	  var.weight  =  0  
	  else  
	   	  var.tcibd001.cwun  =  Items.WeightUnit  
	   	  var.weight  =  Items.Weight  
	  end if  
	  if Items.SearchKeyI  <>  "" then  
	   	  var.tcibd001.seak  =  UCase(Left(Items.SearchKeyI, 16))  
	  else  
	   	  var.tcibd001.seak  =  UCase(Left(Items.ItemDescription, 16))  
	  end if  
	   
	  if Items.SearchKeyII  <>  "" then  
	   	  var.tcibd001.seab  =  UCase(Left(Items.SearchKeyII, 16))  
	  else  
	   	  var.tcibd001.seab  =  UCase(Left(Items.Item, 16))  
	  end if  
'  |  Setting for Alternative Items  
	  var.tcibd001.repl  =  5  	   	   	   	   	  '  |  Not Applicable  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where ( AlternativeItems.Project  =  "" and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  '  |  If (varstr.cprj  =  "" and AlternativeItems.Item  =  varstr.item) then  
	   	   	   	  var.tcibd001.repl  =  10  	   	   	  '  |  Replaced  
	   	   	  '  |  End If  
	   	  endselect  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  "" and AlternativeItems.AlternativeItem  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  15  	   	   	  '  |  Substitute  
	   	  endselect  
	  else  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  varstr.cprj and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  10  	   	   	  '  |  Replaced  
	   	  endselect  
	  end if  
	   
	  '  |  In case of Lot Controlled  	   	   
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.lotcontrolled  =  Items.LotControlled  
	  else  
	   	  var.lotcontrolled  =  2  
	  end if  
	  '  |  In case of Serialized Items  
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.serialized  =  Items.Serialized  
	  else  
	   	  var.serialized  =  2  
	  end if  
	   
'  |   *  Setting variables for Item Purchase Data  
	  if Items.UnitforSupplyTime  =  "" then  
	   	  Items.UnitforSupplyTime  =  10  
	  end if  
	  if Items.ItemType  =  4 then  
	   	  var.tdipu001.retw  =  2  
	   	  var.tdipu001.cwar  =  ""  
	   	  Items.LocationControlled  =  2  
	   	  Items.OutboundMethod  =  3  
	  else  
	   	  var.tdipu001.retw  =  1  
	   	  var.tdipu001.cwar  =  Items.Warehouse  
	  end if  
	  if Items.SupplyTime  <  "0" then  
	   	  Items.SupplyTime  =  "0"  
	  end if  
'  |   *  Setting variables for Item Ordering Data  
	  if Items.OrderSystem  =  4 and Items.ItemType  <>  3 then  
	   	  var.ordersystem  =  9  
	  else  
	   	  var.ordersystem  =  Items.OrderSystem  
	  end if  
	  if (Items.OrderQuantityIncrement  <=  "0") then  
	   	  var.oqmf  =  1  
	  else  
	   	  var.oqmf  =  Items.OrderQuantityIncrement  
	  end if  
	  if (Items.MinimumOrderQuantity  <=  "0") then  
	   	  var.mioq  =  1  
	  else  
	   	  var.mioq  =  Items.MinimumOrderQuantity  
	  end if  
	  if (Items.MaximumOrderQuantity  <=  "0") then  
	   	  var.maoq  =  9999999  
	  else  
	   	  var.maoq  =  Items.MaximumOrderQuantity  
	  end if  
	  if (Items.FixedOrderQuantity  <=  "0") then  
	   	  var.fioq  =  1  
	  else  
	   	  var.fioq  =  Items.FixedOrderQuantity  
	  end if  
	  if (Items.EconomicOrderQuantity  <=  "0") then  
	   	  var.ecoq  =  1  
	  else  
	   	  var.ecoq  =  Items.EconomicOrderQuantity  
	  end if  
'  |   *  SL244255.so  
'  |   	  if (Items.ReorderPoint  <=  "0") then  
'  |   	   	  var.reop  =  var.ecoq  
'  |   	  else  
'  |   	   	  var.reop  =  Items.ReorderPoint  
'  |   	  end if  
'  |   *  SL244255.eo  
	  var.reop  =  Items.ReorderPoint  	   	   	  '  |   *  SL244255.n  
	   
'  |   *  Setting variables for Item Sales Data  
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.releasetowarehouse  =  1  
	  else  
	   	  var.releasetowarehouse  =  2  
	  end if  
	  if Items.SalesPrice  <  "0" then  
	   	  Items.SalesPrice  =  "0"  
	  end if  
	  if Items.SuggestedRetailPrice  <  "0" then  
	   	  Items.SuggestedRetailPrice  =  "0"  
	  end if  
	   
'  |   *  Setting variables for Item Production Data  
	  if Items.BackflushIfMaterial  =  0 then  
	   	  Items.BackflushIfMaterial  =  2  
	  end if  
	  if Items.BackflushMaterials  =  0 then  
	   	  Items.BackflushMaterials  =  2  
	  end if  
	  if Items.BackflushHours  =  0 then  
	   	  Items.BackflushHours  =  2  
	  end if  
	  if Items.OrderLeadTimeUnit  =  0 then  
	   	  Items.OrderLeadTimeUnit  =  5  
	  end if  
	  if Items.RoutingQuantity  <=  "0" then  
	   	  Items.RoutingQuantity  =  "1"  
	  end if  
	  if Items.BOMQuantity  <=  "0" then  
	   	  Items.BOMQuantity  =  "1"  
	  end if  
	  if Items.ScrapFactor  <  "0" then  
	   	  Items.ScrapFactor  =  "0"  
	  end if  
	  if Items.ScrapQuantity  <  "0" then  
	   	  Items.ScrapQuantity  =  "0"  
	  end if  
	  if Items.OrderLeadTime  <  "0" then  
	   	  Items.OrderLeadTime  =  "0"  
	  end if  
	   
'  |   *  Setting variables for Item Costing Data  
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.acpo  =  Items.AggregatedOperationCostComp  
	   	  var.acps  =  Items.AggregatedSurchargeCostComp  
	  else  
	   	  var.acpo  =  ""  
	   	  var.acps  =  ""  
	  end if  
	   
'  |   *  Setting variables for Item Service Data  
	  if Items.ConfigurationControlled  <>  1 then  
	   	  Items.SerializedItemGroup  =  ""  
	  end if  
	   
	  if Items.LocationControlled  =  0 then  
	   	  Items.LocationControlled  =  1  
	  end if  
'  *  SL244268.so  
'  *  Logic warehouse item data moved to separate script  	   
'  	  if Items.LocationControlled  =  1 then  
'  	   	  var.whwmd210.ialt  =  5  
'  	  else  
'  	   	  var.whwmd210.ialt  =  20  
'  	  end if  
'  *  SL244268.eo  
	  if Items.FloorStock  =  0 then  
	   	  Items.FloorStock  =  2  
	  end if  
	  if Items.OutboundMethod  =  0 then  
	   	  Items.OutboundMethod  =  2  
	  end if  
	  if Items.InventoryCarryingCosts  <  "0" then  
	   	  Items.InventoryCarryingCosts  =  "0"  
	  end if  
	  if Items.Height  <  "0" then  
	   	  Items.Height  =  "0"  
	  end if  
	  if Items.Width  <  "0" then  
	   	  Items.Width  =  "0"  
	  end if  
	  if Items.Depth  <  "0" then  
	   	  Items.Depth  =  "0"  
	  end if  
	   
	  if Items.LotPrice  =  0 then  
	   	  Items.LotPrice  =  2  
	  end if  
	   
'  |  In case of Lot  -  controlled and  /  or serialized items  
	  if Items.LotControlled  =  1 then  
	   	  if Items.LotsInInventory  =  1 then  
	   	   	  var.ltpr  =  Items.LotPrice  
	   	   	  var.lttr  =  1  
	   	   	  var.linv  =  1  
	   	   	  var.ledd  =  3  
	   	   	  var.ledr  =  3  
	   	   	  var.ledt  =  3  
	   	   	  var.lisf  =  3  
	   	   	  var.lism  =  3  
	   	  else  
	   	   	  var.ltpr  =  Items.LotPrice  
	   	   	  var.lttr  =  1  
	   	   	  var.linv  =  2  
	   	   	  var.ledd  =  1  
	   	   	  var.ledr  =  2  
	   	   	  var.ledt  =  2  
	   	   	  var.lisf  =  2  
	   	   	  var.lism  =  2  
	   	  end if  
	   	   
	  else  
	   	  var.ltpr  =  2  
	   	  var.lttr  =  2  
	   	  var.linv  =  2  
	   	  var.ledd  =  3  
	   	  var.ledr  =  3  
	   	  var.ledt  =  3  
	   	  var.lisf  =  3  
	   	  var.lism  =  3  
	  end if  
	  if Items.Serialized  =  1 then  
	   	  if Items.SerialsInInventory  =  1 then  
	   	   	  var.srpr  =  Items.SerialPrice  
	   	   	  var.srtr  =  1  
	   	   	  var.sinv  =  1  
	   	   	  var.sedd  =  3  
	   	   	  var.sedr  =  3  
	   	   	  var.sedt  =  3  
	   	   	  var.sisf  =  3  
	   	   	  var.sism  =  3  
	   	  else  
	   	   	  var.srpr  =  Items.SerialPrice  
	   	   	  var.srtr  =  1  
	   	   	  var.sinv  =  2  
	   	   	  var.sedd  =  1  
	   	   	  var.sedr  =  2  
	   	   	  var.sedt  =  2  
	   	   	  var.sisf  =  2  
	   	   	  var.sism  =  2  
	   	  end if  
	  else  
	   	  var.srpr  =  2  
	   	  var.srtr  =  2  
	   	  var.sinv  =  2  
	   	  var.sedd  =  3  
	   	  var.sedr  =  3  
	   	  var.sedt  =  3  
	   	  var.sisf  =  3  
	   	  var.sism  =  3  
	  end if  
	   
'  |   *  Setting variables for Item Planning Data  
	  if Items.ExtraLeadTime  <  "0" then  
	   	  Items.ExtraLeadTime  =  "0"  
	  end if  
	  if Items.ForecastTimeFence  <  "0" then  
	   	  Items.ForecastTimeFence  =  "0"  
	  end if  
	  if Items.TimeFence  <  "0" then  
	   	  Items.TimeFence  =  "0"  
	  end if  
	  if Items.UnitForExtraLeadTime  =  0 then  
	   	  Items.UnitForExtraLeadTime  =  10  
	  end if  
	  if Items.TimeFenceUnit  =  0 then  
	   	  Items.TimeFenceUnit  =  10  
	  end if  
	  if Items.OrderHorizon  <=  "0" then  
	   	  if Items.MaintainMasterPlan  =  2 then  
	   	   	  Items.OrderHorizon  =  "180"  
	   	   	  var.cprpd100.ptmf  =  "180"  
	   	  else  
	   	   	  Items.OrderHorizon  =  "180"  
	   	   	  var.cprpd100.ptmf  =  "360"  
	   	  end if  	   	   	   
	  else  
	   	  if Items.MaintainMasterPlan  =  2 then  
	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  
	   	  else  
	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  *  2  
	   	  end if  
	  end if  
	   
'  |   	  DetermineSrce()  	   	   	   	   	  '  |   *  FP6.n '  |   *  249608.o  
	  var.tcibd001.srce  =  DetermineSrce(Items.ItemType)  	  '  |   *  FP6.n '  |   *  249608.n  
	  dump 001 '  |   *  Dump for tcibd001  
	  dump 400 '  |   *  Dump for whwmd400  
	   
	  if Items.ItemPurchaseData  <>  2 then  
	   	  var.tdipu001.sopr  =  set.source.of.price(Items.ItemType)  	  '  |  Fp8.n  
	   	  dump 002 '  |   *  Dump for tdipu001  
'  |  243214.sn  
	   	  dump 102 '  |   *  Dump for tdipu100  
'  |  243214.en  
	  end if  
	   
	  if Items.ItemSalesData  <>  2 then  
	   	  dump 003 '  |   *  Dump for tdisa001  
	  end if  
	   
	  if Items.ItemProductionData  <>  2 and _  
	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5) then  
	   	  dump 004 '  |   *  Dump for tiipd001  
	  end if  
	   
	  if Items.ItemType  <>  6 and Items.ItemType  <>  10 then  
	   	  dump 007 '  |   *  Dump for ticpr007  
	  end if  
	   
	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  10) then  
	   	  dump 100 '  |   *  Dump for tcibd100  
	  end if  
	   
	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5 or Items.ItemType  =  10) then  
	   	  cluster.found  =  0  
	   	  If varstr.cprj  =  "" or IsNUll(varstr.cprj) then  
	   	   	  select  	  ItemsByCluster.*   
	   	   	  from  	  ItemsByCluster  
	   	   	  where  	  (ItemsByCluster.Project  =  "" and ItemsByCluster.Item  =  varstr.item)  
	   	   	  selectdo  
	   	   	   	  cluster.found  =  1  
	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	  '  |  244355.n  
	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	  '  |  244355.n  
	   	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	   	  dump 120 '  |   *  Dump for cprpd120  
	   	   	  endselect  
	   	  Else  
	   	   	  select  	  ItemsByCluster.*   
	   	   	  from  	  ItemsByCluster  
	   	   	  where  	  (ItemsByCluster.Project  =  varstr.cprj and ItemsByCluster.Item  =  varstr.item)  
	   	   	  selectdo  
	   	   	   	  cluster.found  =  1  
	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	  '  |  244355.n  
	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	  '  |  244355.n  
	   	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	   	  dump 120 '  |   *  Dump for cprpd120  
	   	   	  endselect  
	   	  End If  	   	   
	   	  if cluster.found  =  0 then  
	   	   	  varstr.clus  =  "   "  	   	   
	   	   	  var.planned.item  =  get.segment.cp.item.code(varstr.clus,varstr.cprj,varstr.item)  
	   	   	  var.cprpd100.cwar  =  Items.Warehouse  	   	   	  '  |  244355.n  
	   	   	  var.cprpd100.sour  =  1  	   	   	   	   	  '  |  244355.n  
	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	  dump 120 '  |   *  Dump for cprpd120  
	   	  end if  
	   	  dump 200 '  |   *  Dump for tcibd200  
	  end if  
	   
	  if Items.ItemServiceData  <>  2 and _  
	   	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  
	   	   	  dump 201 '  |   *  Dump for tsmdm200  
	  end if  
	  if Items.ItemProjectData  <>  2 then  
	   	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  	   
	   	   	  dump 005 '  |   *  Dump for tppdm005  
	   	  end if  
	  end if  
'  *  SL244268.so  
'  *  Logic warehouse item data moved to separate script  
'  	  if (Items.ItemType  =  1 or Items.ItemType  =  2) then  
'  *   	   	   |  dump 210 '  |   *  Dump for whwmd210  
'  *   	   	   |  dump 215 '  |   *  Dump for whwmd215  
'  *   	   	   |  dump 216 '  |   *  Dump for whwmd216  
'  	  end if  
'  *  SL244268.eo  
	
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:S
:QURY:START
select  	  Items.*
from 	  Items
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:D
:QURY:START
	  dump 64 '  |  PE to tcibd001  
	  dump 65 '  |  PE to tdipu001  
	  dump 66 '  |  PE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:S
:QURY:START
select ProjectEquipments.*
from ProjectEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:D
:QURY:START
	  if ProjectSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuti  
	  end if  
	  dump 74 '  |   *  PS to tcibd001  
	  dump 75 '  |   *  PS to tdipu001  
	  dump 76 '  |   *  PS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:S
:QURY:START
select ProjectSubcontractings.*
from ProjectSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:D
:QURY:START
	  if StandardEquipments.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 61 '  |   *  SE to tcibd001  
	  dump 62 '  |   *  SE to tdipu001  
	  dump 63 '  |   *  SE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:S
:QURY:START
select StandardEquipments.*
from StandardEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:D
:QURY:START
	  if StandardSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuti  
	  end if  
	  if StandardSubcontractings.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 71 '  |   *  SS to tcibd001  
	  dump 72 '  |   *  SS to tdipu001  
	  dump 73 '  |   *  SS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:S
:QURY:START
select StandardSubcontractings.*
from StandardSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AlternativeItems
:ICOD:D
:QURY:START
	  var.str.sdte  =  get.utc(AlternativeItems.IntroductionDate,"yes")  
	  var.str.edte  =  get.utc(AlternativeItems.ExpiryDate,"no")  
dump 005
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AlternativeItems
:ICOD:S
:QURY:START
select AlternativeItems.*
from AlternativeItems
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:ibd
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AlternativeItems
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:mcs
:TFLNO:052
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:mcs
:TFLNO:052
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:S
:QURY:START
select Projects.*
from Projects
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tc
:TCMOD:mcs
:TFLNO:052
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:D
:QURY:START
	  var.tdipu010.scrp  =  ItemPurchaseBP.SourcingPercentage  
	  if (var.tdipu010.scrp  =  "0") then  
	   	  var.tdipu010.scrp  =  100  
	  end if  
	   
	  var.tdipu010.efdt  =  get.utc(ItemPurchaseBP.EffectiveDate,"yes")  
	  'var.tdipu010.exdt  =  get.utc(ItemPurchaseBP.ExpDate,"yes")  
	  If ItemPurchaseBP.ExpDate  =  "" or IsNull(ItemPurchaseBP.ExpDate) then  	   
	   	  var.tdipu010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tdipu010.exdt  =  get.utc(ItemPurchaseBP.ExpDate,"yes")  
	  end if  
	  varstr.cprj  =  ItemPurchaseBP.Project  
	  varstr.item  =  ItemPurchaseBP.Item  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select  	  Items.*   
	   	  from  	   	  Items  
	   	  where  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  else  
	   	  select Items.*   
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj AND Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  end if  
	  dump 010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:S
:QURY:START
select ItemPurchaseBP.*
from ItemPurchaseBP
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:D
:QURY:START
	  var.tdisa010.efdt  =  get.utc(ItemSalesBP.EffectiveDate,"yes")  
	  'var.tdisa010.exdt  =  get.utc(ItemSalesBP.ExpDate,"yes")  	   
	  If ItemSalesBP.ExpDate  =  "" or IsNull(ItemSalesBP.ExpDate) then  	   
	   	  var.tdisa010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tdisa010.exdt  =  get.utc(ItemSalesBP.ExpDate,"yes")  
	  end if  
dump 010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:S
:QURY:START
select ItemSalesBP.*
from ItemSalesBP
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixDefinitions
:ICOD:D
:QURY:START
	   
	  Matrix.Level.found  =  tdpcg010.get.matrix.sequences(MatrixDefinitions.MatrixType, MatrixDefinitions.MatrixDefinition, var.tdpcg010.malv, var.tdpcg010.mapr)  
	  if not Matrix.Level.found then  
	   	  'Sequences for matrix definition not found then Fill variables with default values.  	   
	   	  var.tdpcg010.malv  =  6 'Not applicable  
	   	  var.tdpcg010.mapr  =  0  	   
	  end if  
	  dump 010  	  'tdpcg010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixDefinitions
:ICOD:S
:QURY:START
select  	  MatrixDefinitions.*
from 	  MatrixDefinitions
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixDefinitions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBookCodes
:ICOD:D
:QURY:START
dump 011
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBookCodes
:ICOD:S
:QURY:START
select PriceBookCodes.*
from PriceBookCodes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBookCodes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixSequences
:ICOD:D
:QURY:START
	  var.tdpcg020.efdt  =  get.utc(MatrixSequences.EffectiveDate,"yes")  
	  var.tdpcg020.exdt  =  get.utc(MatrixSequences.ExpiryDate,"no")  
	  dump 010 '  |  tdpcg020
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixSequences
:ICOD:S
:QURY:START
select MatrixSequences.*
from MatrixSequences
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixSequences
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:021
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DiscountSchedules
:ICOD:D
:QURY:START
	  var.tdpcg021.efdt  =  get.utc(DiscountSchedules.EffectiveDate,"yes")  
	  var.tdpcg021.exdt  =  get.utc(DiscountSchedules.ExpiryDate,"no")  
	  dump 021 '  |  tdpcg021
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:021
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DiscountSchedules
:ICOD:S
:QURY:START
select  	  DiscountSchedules.*
from 	  DiscountSchedules
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:021
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DiscountSchedules
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:D
:QURY:START
	  var.tdpcg030.efdt  =  get.utc(Matrices.EffectiveDate,"yes")  
	   
	   
	  dump 030 '  |  tdpcg030
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:S
:QURY:START
select Matrices.*
from Matrices
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:D
:QURY:START
	  var.tdpcg031.efdt  =  get.utc(PriceBooks.EffectiveDate,"yes")  
	  var.tdpcg031.exdt  =  get.utc(PriceBooks.ExpiryDate,"no")  	   
	  var.tdpcg031.endt  =  get.utc(PriceBooks.EntryDate,"yes")  	   
	   
	  dump 031 '  |  tdpcg031
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:S
:QURY:START
select PriceBooks.*
from PriceBooks
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:fam
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Assets
:ICOD:D
:QURY:START
	  if Assets.AssetDistrBy  =  "0" then  
	   	  var.dbfg  =  1  
	  else  
	   	  var.dbfg  =  Assets.AssetDistrBy  
	  end if  
	  if Assets.Listed  =  "0" then  
	   	  var.list  =  2  
	  else  
	   	  var.list  =  Assets.Listed  
	  end if  
	  if Assets.New  =  "0" then  
	   	  var.newu  =  1  
	  else  
	   	  var.newu  =  Assets.New  
	  end if  
	  if Assets.Owner  =  "0" then  
	   	  var.ownc  =  1  
	  else  
	   	  var.ownc  =  Assets.Owner  
	  end if  
	  if len(trim(Assets.Description))  >  0 then  
	   	  varstr.dsca  =  Assets.Description  	   	   
	  else  
	   	  varstr.dsca  =  Assets.AssetNumber  &  ", "  &  Assets.AssetExtension  
	  end if  
	   
	  var.tffam100.ratd  =  get.utc(Assets.RateDate,"yes")  
	  var.tffam100.acmd  =  get.date(Assets.LastMaintDate,"no")  
	  var.tffam100.pudt  =  get.date(Assets.PurchaseDate,"yes")  
	  var.tffam100.srvc  =  get.date(Assets.ServiceDate,"yes")  
	  dump 100 '  |  tffam100
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:fam
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Assets
:ICOD:S
:QURY:START
select Assets.*
from Assets
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:fam
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Assets
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:fam
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssetBook
:ICOD:D
:QURY:START
	  if AssetBook.DeprBelowSalvage  =  0 then  
	   	  var.bslv  =  2  
	  else  
	   	  var.bslv  =  AssetBook.DeprBelowSalvage  
	  end if  
	  if AssetBook.EconomicRecapture  =  0 then  
	   	  var.ecre  =  2  
	  else  
	   	  var.ecre  =  AssetBook.EconomicRecapture  
	  end if  
	   
	  var.tffam110.curd  =  get.date(AssetBook.RecoveryDate,"no")  
	  var.tffam110.disd  =  get.date(AssetBook.FinalDisposalDate,"no")  
	  var.tffam110.last  =  get.date(AssetBook.LastDeprDate,"no")  
	   	   
	  dump 110 '  |  tffam110
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:fam
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssetBook
:ICOD:S
:QURY:START
select AssetBook.*
from AssetBook
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:fam
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssetBook
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionType
:ICOD:D
:QURY:START
	  dump 002  	  '  |  tfgld002
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionType
:ICOD:S
:QURY:START
select DimensionType.*
from DimensionType
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionType
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Periods
:ICOD:D
:QURY:START
	  dump 1
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Periods
:ICOD:S
:QURY:START
select Periods.*
from Periods
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Periods
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:006
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:D
:QURY:START
	  var.tfgld006.ydsc  =  EndDatesByYear.ydsc  	   
	  '  |  Description is mandatory  
	  if EndDatesByYear.ydsc  =  empty then  
	   	  var.tfgld006.ydsc  =  EndDatesByYear.year  
	  end if  
	  dump 1
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:006
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:S
:QURY:START
select EndDatesByYear.*
from EndDatesByYear
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:006
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:D
:QURY:START
	  If Trim(varstr.SourceGLVersion)  =  "Other" then  
	  '  |  Migrate non  -  InforFMS data  
	   	  if ChartOfAccounts.Dimension1Used  =  "0" then  
	   	   	  var.dim1  =  2 '  |  Optional  
	   	  else  
	   	   	  var.dim1  =  ChartOfAccounts.Dimension1Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension2Used  =  "0" then  
	   	   	  var.dim2  =  2  
	   	  else  
	   	   	  var.dim2  =  ChartOfAccounts.Dimension2Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension3Used  =  "0" then  
	   	   	  var.dim3  =  2  
	   	  else  
	   	   	  var.dim3  =  ChartOfAccounts.Dimension3Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension4Used  =  "0" then  
	   	   	  var.dim4  =  2  
	   	  else  
	   	   	  var.dim4  =  ChartOfAccounts.Dimension4Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension5Used  =  "0" then  
	   	   	  var.dim5  =  2  
	   	  else  
	   	   	  var.dim5  =  ChartOfAccounts.Dimension5Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension6Used  =  "0" then  
	   	   	  var.dim6  =  2  
	   	  else  
	   	   	  var.dim6  =  ChartOfAccounts.Dimension6Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension7Used  =  "0" then  
	   	   	  var.dim7  =  2  
	   	  else  
	   	   	  var.dim7  =  ChartOfAccounts.Dimension7Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension8Used  =  "0" then  
	   	   	  var.dim8  =  2  
	   	  else  
	   	   	  var.dim8  =  ChartOfAccounts.Dimension8Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension9Used  =  "0" then  
	   	   	  var.dim9  =  2  
	   	  else  
	   	   	  var.dim9  =  ChartOfAccounts.Dimension9Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension10Used  =  "0" then  
	   	   	  var.dim10  =  2  
	   	  else  
	   	   	  var.dim10  =  ChartOfAccounts.Dimension10Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension11Used  =  "0" then  
	   	   	  var.dim11  =  2  
	   	  else  
	   	   	  var.dim11  =  ChartOfAccounts.Dimension11Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension12Used  =  "0" then  
	   	   	  var.dim12  =  2  
	   	  else  
	   	   	  var.dim12  =  ChartOfAccounts.Dimension12Used  
	   	  end if  
	   	  if ChartOfAccounts.DualAccountingIndicator  =  "0" then  
	   	   	  var.duac  =  1  
	   	  else  
	   	   	  var.duac  =  ChartOfAccounts.DualAccountingIndicator  
	   	  end if  
	   	  if ChartOfAccounts.FixedAssetIntegration  =  "0" then  
	   	   	  var.ifas  =  4  
	   	  else  
	   	   	  var.ifas  =  ChartOfAccounts.FixedAssetIntegration  
	   	  end if  
	   	  if ChartOfAccounts.IntegrationAccount  =  "0" then  
	   	   	  var.inta  =  2  
	   	  else  
	   	   	  var.inta  =  ChartOfAccounts.IntegrationAccount  
	   	  end if  
	   	  if ChartOfAccounts.IntegrationIndicator  =  "0" then  
	   	   	  var.iprj  =  7  
	   	  else  
	   	   	  var.iprj  =  ChartOfAccounts.IntegrationIndicator  
	   	  end if  
	   	  if ChartOfAccounts.BlockingStatus  =  "0" or Trim(ChartOfAccounts.BlockingStatus)  =  "" then  
	   	   	  var.bloc  =  1  
	   	  else  
	   	   	  var.bloc  =  ChartOfAccounts.BlockingStatus  
	   	  end if  
	   	  if var.bloc  =  1 then  
	   	   	  var.bfdt  =  get.date("","no")  
	   	   	  var.budt  =  get.date("","no")  
	   	  else  
	   	   	  var.bfdt  =  get.date(ChartOfAccounts.BlockingEffectiveFrom,"no")  
	   	   	  var.budt  =  get.date(ChartOfAccounts.BlockingEffectiveTo,"no")  
	   	  end if  
	   	  dump 008 ' | Other GL Source version  
	  else  
	  '  |  Migrate InforFMS data  
	   	  '  |  Mapping of AccountType to D  /  C Indicator  
	   	  acc.type  =  ChartOfAccounts.AccountTypeInforFMS  
	   	  if trim(acc.type)  <>  "" then  
	   	   	  varstr.OpenDate  =  ChartOfAccounts.OpenDateInforFMS  
	   	   	  varstr.ClosedDate  =  ChartOfAccounts.ClosedDateInforFMS  
	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Closed" then  
	   	   	   	  if varstr.OpenDate  =  "" then  
	   	   	   	   	  varstr.OpenDate  =  date()  
	   	   	   	  end if  
	   	   	   	  if varstr.ClosedDate  =  "" then  	   	   	   
	   	   	   	   	  varstr.ClosedDate  =  CDate("12/31/2038")  
	   	   	   	  end if  
	   	   	  end if  
	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Open" then  
	   	   	   	  varstr.OpenDate  =  ""  
	   	   	   	  varstr.ClosedDate  =  ""  
	   	   	  end if  
	   	   	  If acc.type  =  "A" or acc.type  =  "E" or acc.type  =  "V" or acc.type  =  "B" then  
	   	   	   	  varint.DebitCreditIndicator  =  1 '  |  tfgld.dbcr.debit '  |  1 '  |  Debit  
	   	   	  End If  	   
	   	   	  If acc.type  =  "L" or acc.type  =  "I" then  
	   	   	   	  varint.DebitCreditIndicator  =  2 '  |  tfgld.dbcr.credit '  |  2 '  |  Credit  	   
	   	   	  End If  	   
	   	   	  '  |  Mentioning the Account Type  
	   	   	  If acc.type  =  "A" or acc.type  =  "L" or acc.type  =  "B" then  
	   	   	   	  varint.AccountType  =  1 '  |  Balance Sheet  
	   	   	  End If  
	   	   	  if acc.type  =  "E" or acc.type  =  "V" or acc.type  =  "I" then  
	   	   	   	  varint.AccountType  =  2 '  |  Profit  &  Loss  
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GL2" then  
	   	   	   	  '  |  Determining the Status for the Blocking field  
	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free '  |  1  
	   	   	   	  '  |  Currency Analysis  
	   	   	   	  var.icur  =  1 '  |  tcicur.not.required '  |  1  
	   	   	   	  '  |  For Sublevel  
	   	   	   	  var.sublevel  =  0 '  |  ChartOfAccounts.Sublevel '  |  default()  
	   	   
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GL3" then  
	   	   	   	  '  |  Determining the Status for the Blocking field  
	   	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Open" then  
	   	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free '  |  1  
	   	   	   	  else  	   	   
	   	   	   	   	  var.status  =  3 '  |  tfgld.bloc.all.input '  |  3  
	   	   	   	  end if  
	   	   	   	  '  |  Currency Analysis  
	   	   	   	  var.icur  =  2 '  |  tcicur.required '  |  2  
	   	   	   	  '  |  For Sublevel  
	   	   	   	  var.sublevel  =  0 '  |  ChartOfAccounts.Sublevel '  |  default()  
	   
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GLE" then  
	   	   	   	  if acc.type  =  "1" or acc.type  =  "5" or acc.type  =  "6" or acc.type  =  "8" then  
	   	   	   	   	  varint.DebitCreditIndicator  =  1 '  |  tfgld.dbcr.debit  
	   	   	   	  end if  	   
	   	   	   	  if acc.type  =  "2" or acc.type  =  "3" or acc.type  =  "4" or acc.type  =  "7" then  
	   	   	   	   	  varint.DebitCreditIndicator  =  2 '  |  tfgld.dbcr.credit  
	   	   	   	  end if  	   
	   	   	   	  '  |  Mentioning the Account Type  
	   	   	   	  if acc.type  =  "1" or acc.type  =  "2" or acc.type  =  "3" then  
	   	   	   	   	  varint.AccountType  =  1 '  |  Balance Sheet  
	   	   	   	  else  
	   	   	   	   	  varint.AccountType  =  2 '  |  Profit  &  Loss  
	   	   	   	  end if  	   
	   	   	   	  '  |  Currency Analysis  	   
	   	   	   	  var.icur  =  1 '  |  tcicur.not.required  
	   	   	   	  '  |  Status of Blocking field  
	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free  
	   	   	   	  '  |  Calculating Sublevel  
	   	   	   	  var.sublevel  =  ChartOfAccounts.LedgerAccountSublevel  
	   
	   	   	  end if  
	   	   	  dump 009 '  |  Chart Of Accounts InforFMS  
	   	  end if  
	  End If
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:S
:QURY:START
select ChartOfAccounts.*
from ChartOfAccounts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:D
:QURY:START
	  dump 011
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:S
:QURY:START
select TransactionTypes.*
from TransactionTypes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:017
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypeSeries
:ICOD:D
:QURY:START
	  dump 017
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:017
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypeSeries
:ICOD:S
:QURY:START
select  	  TransactionTypeSeries.*
from 	  TransactionTypeSeries
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:017
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypeSeries
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:D
:QURY:START
	  If varstr.source.gl.version  =  "GL2" or varstr.source.gl.version  =  "GL3" then  
	  '  |  Migrate data for InforFMS 'M  -  Series'  
	   	  If GLTransactions.CurrencySource  =  empty then  
	   	   	  varstr.currency  =  GeneralParameters.BookingCurrency1  
	   	  Else  
	   	   	  varstr.currency  =  GLTransactions.CurrencySource  
	   	  End If  
	   	   
	   	  var.rate1  =  get.rate(GLTransactions.Rate1, var.RateFactor1)  
	   	  var.rate2  =  get.rate(GLTransactions.Rate2, var.RateFactor2)  
	   	  If GLTransactions.RateDate  =  empty then  
	   	   	  var.RateDate  =  GLTransactions.EffectiveDateInforFMS  
	   	  Else  
	   	   	  var.RateDate  =  GLTransactions.RateDate  
	   	  End If  
	   	  if trim(var.rate1)  =  "" then  	   
	   	   	  var.rate1  =  "1.000000"  
	   	  end if  
	   	  if trim(var.rate2)  =  "" then  	   
	   	   	  var.rate2  =  "0.000001"  
	   	  end if  
	   	  If GLTransactions.RateTypeSource  =  empty then  
	   	   	  varstr.RateType  =  GeneralParameters.ExchangeRateType  
	   	  Else  
	   	   	  varstr.RateType  =  GLTransactions.RateTypeSource  
	   	  End If  
	   	  If varstr.source.gl.version  =  "GL2" then  
	   	   	  var.GLTransaction.BookingAmount2  =  GLTransactions.BookingAmount2  
	   	  Else  
	   	   	  var.GLTransaction.BookingAmount2  =  0  
	   	  End If  
	   	  If GLTransactions.EffectiveDateInforFMS  <>  varstr.PrevEffectiveDate then  
	   	   	  var.tfgld106.olin  =  1  	   
	   	   	  If varstr.source.gl.version  =  "GL2" then  	   
	   	   	   	  var.DocumentID  =  var.DocumentID  +  1  
	   	   	   	  dump 018 '  |  Documents InforFMS GL2  /  GL3  
	   	   	  End If  
	   	  Else  
	   	   	  var.tfgld106.olin  =  var.tfgld106.olin  +  1  
	   	  End if  
	   	  varstr.PrevEffectiveDate  =  GLTransactions.EffectiveDateInforFMS  
	  End If  
	  varstr.dim2  =  Mid (GLTransactions.Reference1 , 22 , 1 )  
	  varstr.dim3  =  Mid (GLTransactions.Reference1 , 24 , 9 )  
	  dump 106 '  |  Finalized Transactions InforFMS GL2  /  GL3  
	  If varstr.source.gl.version  =  "GLE" then  
	  '  |  Migrate data for InforFMS 'E  -  Series'  
	   	  select  	  GLTransactions.*   
	   	  from  	  GLTransactions  
	   	  order by GLTransactions.FiscalYear, GLTransactions.Period Asc  
	   	  selectdo  
	   	   	  If GLTransactions.CurrencySource  =  empty then  
	   	   	   	  varstr.currency  =  GeneralParameters.BookingCurrency1  
	   	   	  Else  
	   	   	   	  varstr.currency  =  GLTransactions.CurrencySource  
	   	   	  End If  
	   	   	  var.rate1  =  get.rate(GLTransactions.Rate1, var.RateFactor1)  
	   	   	  var.rate2  =  get.rate(GLTransactions.Rate2, var.RateFactor2)  
	   	   	  If GLTransactions.RateDate  =  empty then  
	   	   	   	  var.RateDate  =  GLTransactions.EffectiveDate  
	   	   	  Else  
	   	   	   	  var.RateDate  =  GLTransactions.RateDate  
	   	   	  End If  
	   	   	  If GLTransactions.RateTypeSource  =  empty then  
	   	   	   	  varstr.RateType  =  GeneralParameters.ExchangeRateType  
	   	   	  Else  
	   	   	   	  varstr.RateType  =  GLTransactions.RateTypeSource  
	   	   	  End If  
	   	   	  If GLTransactions.FiscalYear  <>  varint.PrevFiscalYear Or GLTransactions.Period  <>  varint.PrevPeriod then  
	   	   	   	  var.DocumentID  =  var.DocumentID  +  1  
	   	   	   	  dump 918 '  |  Documents InforFMS GLE  
	   	  End If  
	   	  varint.PrevFiscalYear  =  GLTransactions.FiscalYear  
	   	  varint.PrevPeriod  =  GLTransactions.Period  
	   	  dump 906 '  |  Finalized Transactions InforFMS GLE  
	  endselect  
End If  
If varstr.source.gl.version  =  "Other" then  
'  |  Migrate data for other source systems  
End If
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:S
:QURY:START
select  	  GLTransactions.*
from 	  GLTransactions  
'  |  order by GLTransactions.EffectiveDateInforFMS Asc
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:D
:QURY:START
	  var.tibom010.indt  =  get.utc(BillOfMaterial.EffectiveDate,"yes")  
	  'var.tibom010.exdt  =  get.utc(BillOfMaterial.ExpiryDate,"no")  	   	   
	  If BillOfMaterial.ExpiryDate  =  "" or IsNull(BillOfMaterial.ExpiryDate) then  	   
	   	  var.tibom010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tibom010.exdt  =  get.utc(BillOfMaterial.ExpiryDate,"no")  
	  end if  
	  dump 010 '  |  tibom010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:S
:QURY:START
select BillOfMaterial.*
from BillOfMaterial
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:D
:QURY:START
	  if Projects.btco  =  1 then  
	   	  var.tppdm600.cmog  =  2  
	  else  
	   	  var.tppdm600.cmog  =  3  
	  end if  
	  if Projects.intp  =  1 then  
	   	  var.tppdm600.ipin  =  2  
	  else  
	   	  var.tppdm600.ipin  =  1  
	  end if  
	  var.tppdm600.rate  =  Projects.rate  
	  if trim(var.tppdm600.rate)  =  "" or IsNull(var.tppdm600.rate) then  
	   	  var.tppdm600.rate  =  1  
	  end if  
	  dump 600 '  |   *  tppdm600  
	  dump 113 '  |   *  tcemm113  
	  dump 610 '  |   *  tcemm110 for tp
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:S
:QURY:START
select Projects.*
from Projects
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:D
:QURY:START
	  varstr.address  =  WorkCenter.Address  
	  select Addresses.City  
	  from  	  Addresses  
	  where Addresses.AddressCode  =  varstr.address  
	  selectdo  
	  endselect  
	   
	  var.tcmcs065.city  =  Left(Addresses.City, 8)  
	  dump 001 '  |   *  tirou001  
	  dump 065 '  |   *  tcmcs065  
	  dump 110 '  |   *  tcemm110  
	  dump 124 '  |   *  tcemm124  
	  dump 200 '  |   *  cprpd200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:S
:QURY:START
select WorkCenter.*
from WorkCenter
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:rou
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingCodesByItem
:ICOD:D
:QURY:START
	  if RoutingCodesByItem.RoutingQuantity  =  "0" then  
	   	  var.tirou101.runi  =  "1"  
	  else  
	   	  var.tirou101.runi  =  RoutingCodesByItem.RoutingQuantity  
	  end if  
	   	   
dump 101
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:rou
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingCodesByItem
:ICOD:S
:QURY:START
select RoutingCodesByItem.*
from RoutingCodesByItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:rou
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingCodesByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:D
:QURY:START
'  |   *  ERP  -  00000  -  51389.sn  
	  var.cycletime  =  RoutingOperation.CycleTime  
	  varstr.cprj  =  RoutingOperation.ManufacturedProject  
	  varstr.item  =  RoutingOperation.ManufacturedItem  
	  varstr.routing  =  RoutingOperation.Routing  
	  var.quantity  =  0  
'  |   *  ERP  -  00000  -  51389.en  
	  If varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select RoutingCodesByItem.RoutingQuantity  
	   	  from  	  RoutingCodesByItem  
	   	  where RoutingCodesByItem.ManufacturedItem  =  varstr.item  
	   	  and  	  RoutingCodesByItem.Routing  =  varstr.routing  
	   	  selectdo  
	   	   	  If RoutingCodesByItem.ManufacturedProject  =  "" or IsNull(RoutingCodesByItem.ManufacturedProject) then  
	   	   	   	  var.quantity  =  RoutingCodesByItem.RoutingQuantity  
	   	   	  End If  
	   	  endselect  
	  else  
	   	  select RoutingCodesByItem.RoutingQuantity  
	   	  from  	  RoutingCodesByItem  
	   	  where RoutingCodesByItem.ManufacturedProject  =  varstr.cprj  
	   	  and  	  RoutingCodesByItem.ManufacturedItem  =  varstr.item  
	   	  and  	  RoutingCodesByItem.Routing  =  varstr.routing  
	   	  selectdo  
	   	   	  var.quantity  =  RoutingCodesByItem.RoutingQuantity  
	   	  endselect  
	  End If  
'  |   *  ERP  -  00000  -  51389.sn  
	  if var.cycletime  >  "0" then  
	   	  if var.quantity  =  "0" then  
'  |  243218.o  	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime) ,2)  
	   	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime) ,2,0,0,0) '  |  243218.n  
	   	  else  
'  |  243218.o  	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime)  *  Cdbl(var.quantity) ,2)  
	   	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime)  *  Cdbl(var.quantity) ,2,0,0,0) '  |  243218.n  
	   	  end if  
	  else  
	   	  var.tirou102.prte  =  0  
	  end if  
'  |   *  ERP  -  00000  -  51389.en  
	  var.tirou102.indt  =  get.utc(RoutingOperation.EffectiveDate,"yes")  
	  If RoutingOperation.ExpiryDate  =  "" or IsNull(RoutingOperation.ExpiryDate)then  	   
	   	  var.tirou102.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tirou102.exdt  =  get.utc(RoutingOperation.ExpiryDate,"yes")  
	  end if  	   
	  dump 102 '  |  tirou102
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:S
:QURY:START
select RoutingOperation.*
from RoutingOperation
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:ctm
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Programs
:ICOD:D
:QURY:START
	  dump 1 '  |  tpctm010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:ctm
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Programs
:ICOD:S
:QURY:START
select  	  Programs.*
from 	  Programs
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:ctm
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Programs
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:015
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardLabors
:ICOD:D
:QURY:START
	  if CDbl(StandardLabors.ratc)  >  0 then  
	   	  var.tppdm015.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm015.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardLabors.rats)  >  0 then  
	   	  var.tppdm015.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm015.ltrs  =  get.utc("","no")  
	  end if  
	  dump 01 '  |   #  tppdm015
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:015
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardLabors
:ICOD:S
:QURY:START
select StandardLabors.*
from StandardLabors
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:015
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardLabors
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:D
:QURY:START
	  if CDbl(StandardEquipments.ratc)  >  0 then  
	   	  var.tppdm025.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardEquipments.rats)  >  0 then  
	   	  var.tppdm025.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrs  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardEquipments.ratp)  >  0 then  
	   	  var.tppdm025.ltrp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:S
:QURY:START
select StandardEquipments.*
from StandardEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:D
:QURY:START
	  if CDbl(StandardSubcontractings.pric)  >  0 then  
	   	  var.tppdm035.ltpc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltpc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSubcontractings.pris)  >  0 then  
	   	  var.tppdm035.ltps  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltps  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSubcontractings.prip)  >  0 then  
	   	  var.tppdm035.ltpp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltpp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:S
:QURY:START
select StandardSubcontractings.*
from StandardSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSundryCosts
:ICOD:D
:QURY:START
	  if CDbl(StandardSundryCosts.pric)  >  0 then  
	   	  var.tppdm040.ltcp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm040.ltcp  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSundryCosts.pris)  >  0 then  
	   	  var.tppdm040.ltsp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm040.ltsp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSundryCosts
:ICOD:S
:QURY:START
select StandardSundryCosts.*
from StandardSundryCosts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSundryCosts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:090
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardElements
:ICOD:D
:QURY:START
	  var.prin  =  StandardElements.prin  
	  '  |  Condition for field 'Progress for Invoice'  
	  var.cspt  =  StandardElements.cspt  
	  if var.prin  =  3 then  	  '  |  Project Physical Progress  
	   	  var.cspt  =  2  	  '  |  Indirect  
	  end if  
	  if var.prin  =  4 then  	  '  |  Not Applicable  
	   	  var.cspt  =  3  	  '  |  Not Applicable  
	  end if  
	  '  |  Condition for field 'To Be Settled'  
	  var.setl  =  2  
	  if var.prin  =  1 then  
	   	  var.setl  =  StandardElements.setl  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:090
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardElements
:ICOD:S
:QURY:START
select StandardElements.*
from StandardElements
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:090
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardElements
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardActivities
:ICOD:D
:QURY:START
	  var.prin  =  StandardActivities.prin  
	  '  |  Determine 'Progress for Invoice'  
	  var.cspt  =  StandardActivities.cspt  
	  if var.prin  =  3 then  	  '  |  Project Physical Progress  
	   	  var.cspt  =  2  	  '  |  Indirect  
	  end if  
	  if var.prin  =  4 then  	  '  |  Not Applicable  
	   	  var.cspt  =  3  	  '  |  Not Applicable  
	  end if  
	  '  |  Determine 'To Be Settled'  
	  var.setl  =  2  
	  if var.prin  =  1 then  
	   	  var.setl  =  StandardActivities.setl  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardActivities
:ICOD:S
:QURY:START
select StandardActivities.*
from StandardActivities
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardActivities
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:153
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaterialPriceFluctuationsIndexTables
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:153
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaterialPriceFluctuationsIndexTables
:ICOD:S
:QURY:START
select MaterialPriceFluctuationsIndexTables.*
from MaterialPriceFluctuationsIndexTables
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:153
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaterialPriceFluctuationsIndexTables
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:S
:QURY:START
select  	  StandardSurchargesGeneralAndByCostType.*
from 	  StandardSurchargesGeneralAndByCostType
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:171
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByCostComponent
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:171
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByCostComponent
:ICOD:S
:QURY:START
select StandardSurchargesByCostComponent.*
from StandardSurchargesByCostComponent
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:171
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByCostComponent
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:172
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByMaterial
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:172
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByMaterial
:ICOD:S
:QURY:START
select StandardSurchargesByMaterial.*
from StandardSurchargesByMaterial
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:172
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByMaterial
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:173
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByLabor
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:173
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByLabor
:ICOD:S
:QURY:START
select StandardSurchargesByLabor.*
from StandardSurchargesByLabor
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:173
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByLabor
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:174
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByEquipment
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:174
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByEquipment
:ICOD:S
:QURY:START
select StandardSurchargesByEquipment.*
from StandardSurchargesByEquipment
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:174
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByEquipment
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:175
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySubcontracting
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:175
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySubcontracting
:ICOD:S
:QURY:START
select StandardSurchargesBySubcontracting.*
from StandardSurchargesBySubcontracting
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:175
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySubcontracting
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:176
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySundryCost
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:176
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySundryCost
:ICOD:S
:QURY:START
select StandardSurchargesBySundryCost.*
from StandardSurchargesBySundryCost
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:176
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySundryCost
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:615
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectLabors
:ICOD:D
:QURY:START
	  if CDbl(ProjectLabors.ratc)  >  0 then  
	   	  var.tppdm615.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm615.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectLabors.rats)  >  0 then  
	   	  var.tppdm615.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm615.ltrs  =  get.utc("","no")  
	  end if  
	  dump 01  	  '  |   *  tppdm615
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:615
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectLabors
:ICOD:S
:QURY:START
select ProjectLabors.*
from ProjectLabors
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:615
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectLabors
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:D
:QURY:START
	  if CDbl(ProjectEquipments.ratc)  >  0 then  
	   	  var.tppdm625.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectEquipments.rats)  >  0 then  
	   	  var.tppdm625.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrs  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectEquipments.ratp)  >  0 then  
	   	  var.tppdm625.ltrp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrp  =  get.utc("","no")  
	  end if  
	  dump 01  	  '  |   *  tppdm625
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:S
:QURY:START
select ProjectEquipments.*
from ProjectEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:D
:QURY:START
	  if CDbl(ProjectSubcontractings.pric)  >  0 then  
	   	  var.tppdm635.ltpc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltpc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSubcontractings.pris)  >  0 then  
	   	  var.tppdm635.ltps  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltps  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSubcontractings.prip)  >  0 then  
	   	  var.tppdm635.ltpp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltpp  =  get.utc("","no")  
	  end if  
	  dump 01  	  '  |   *  tppdm635
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:S
:QURY:START
select ProjectSubcontractings.*
from ProjectSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:640
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSundryCostCodes
:ICOD:D
:QURY:START
	  if Cdbl(ProjectSundryCostCodes.pric)  >  0 then  
	   	  var.tppdm640.ltpr  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm640.ltpr  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSundryCostCodes.pris)  >  0 then  
	   	  var.tppdm640.ltsp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm640.ltsp  =  get.utc("","no")  
	  end if  
	  dump 01  	  '  |   *  tppdm640
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:640
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSundryCostCodes
:ICOD:S
:QURY:START
select ProjectSundryCostCodes.*
from ProjectSundryCostCodes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:640
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSundryCostCodes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:649
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesResponsibleByProject
:ICOD:D
:QURY:START
	  dump 01  	  ' |  * tppdm649
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:649
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesResponsibleByProject
:ICOD:S
:QURY:START
select EmployeesResponsibleByProject.*
from EmployeesResponsibleByProject
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:649
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesResponsibleByProject
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:740
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectBusinessPartners
:ICOD:D
:QURY:START
	  var.tppdm740.rate  =  ProjectBusinessPartners.rate  
	  if trim(var.tppdm740.rate)  =  "" or IsNull(var.tppdm740.rate) then  
	   	  var.tppdm740.rate  =  1  
	  end if  
	  var.tppdm740.raca  =  ProjectBusinessPartners.raca  
	  if trim(var.tppdm740.raca)  =  "" or IsNull(var.tppdm740.raca) then  
	   	  var.tppdm740.raca  =  1  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:740
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectBusinessPartners
:ICOD:S
:QURY:START
select ProjectBusinessPartners.*
from ProjectBusinessPartners
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:740
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectBusinessPartners
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:741
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractAmountsByBusinessPartners
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:741
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractAmountsByBusinessPartners
:ICOD:S
:QURY:START
select ProjectContractAmountsByBusinessPartners.*
from ProjectContractAmountsByBusinessPartners
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pdm
:TFLNO:741
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractAmountsByBusinessPartners
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pss
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectPlans
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pss
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectPlans
:ICOD:S
:QURY:START
select ProjectPlans.*
from ProjectPlans
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pss
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectPlans
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:D
:QURY:START
	  varstr.project  =  Activities.cprj  
	  var.btco  =  1  	   	   	   	  '  |  Default is 'Element'  
	  var.invm  =  3  	   	   	  '  |  Default is 'Installment'  
	  var.secu  =  ""  
	  var.prss  =  0.0000  
	  var.rtse.1  =  0.000000  
	  var.rtse.2  =  0.000000  
	  var.rtse.3  =  0.000000  
	  var.rfse.1  =  0  
	  var.rfse.2  =  0  
	  var.rfse.3  =  0  
	  var.prin  =  4  	   	   	   
	  var.cspt  =  3  	   	   	   
	  var.setl  =  2  
	  var.gris  =  0  
	  select Projects.invm,  
	   	  Projects.btco  
	  from  	  Projects  
	  where Projects.cprj  =  varstr.project  
	  selectdo  
	   	  var.invm  =  Projects.invm  	  '  |  Invoice Type  
	   	  var.btco  =  Projects.btco  	  '  |  Control By  
	  endselect  
	  '  |  Check if 'Invoice Type'  =  Progress Invoice and 'Control By'  =  Activity  	   
	  if var.invm  =  4 and var.btco  =  2 then  	   	   
	   	  var.secu  =  Activities.secu  
	   	  var.prss  =  Activities.prss  
	   	  var.rtse.1  =  Activities.rtse  
	   	  var.rtse.2  =  0.000001  
	   	  var.rtse.3  =  0.000001  
	   	  var.rfse.1  =  Activities.rfse  
	   	  var.rfse.2  =  1  
	   	  var.rfse.3  =  1  
	   	  var.prin  =  Activities.prin  
	   	  '  |  Determine field 'Progress for Invoice'  
	   	  if var.prin  =  3 then  
	   	   	  var.cspt  =  2 '  |  Indirect  
	   	  end if  
	   	  '  |  Determine field 'To Be Settled'  
	   	  if var.prin  =  1 and var.cspt  =  1 then  
	   	   	  var.setl  =  Activities.setl  
	   	  end if  
	   	  if var.prin  =  2 and var.cspt  =  1 then  
	   	   	  var.setl  =  Activities.setl  
	   	  end if  
	   	  '  |  Determine field 'Group Indirect Work'  
	   	  if var.prin  =  1 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	   	  if var.prin  =  2 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	   	  if var.prin  =  3 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	  end if  
	  '  |  In case Actual Finish Date is filled the Actual Start Date must be empty  !   
	  var.asdt  =  Activities.asdt  
	  if trim(Activities.afdt)  <>  "" then  
	   	  var.asdt  =  ""  
	  end if  
	  dump 01  	  '  |   *  tppss200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:S
:QURY:START
select Activities.*
from Activities
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pss
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ActivityBaseline
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pss
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ActivityBaseline
:ICOD:S
:QURY:START
select ActivityBaseline.*
from ActivityBaseline
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:pss
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ActivityBaseline
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:S
:QURY:START
select Extensions.*
from Extensions
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:D
:QURY:START
	  var.prin  =  Elements.prin  
	  '  |  Condition for field 'Progress for Invoice'  
	  var.cspt  =  Elements.cspt  
	  if var.prin  =  2 then  	  '  |  No  
	   	  var.cspt  =  3  	  '  |  Not Applicable  
	  end if  
	  if var.prin  =  3 then  	  '  |  Project Physical Progress  
	   	  var.cspt  =  2  	  '  |  Indirect  
	  end if  
	  '  |  Condition for field 'To Be Settled'  
	  var.setl  =  2  
	  if var.prin  =  1 and var.cspt  =  1 then  
	   	  var.setl  =  Elements.setl  
	  end if  
	  dump 01  	  '  |   *  tpptc100
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:S
:QURY:START
select Elements.*
from Elements
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:D
:QURY:START
	  if Texts.TextID  <>  "NULL" then  
	   	  TextLength  =  len(Texts.Text )  
	   	  TextNumber  =  Texts.TextID  
	   	  TextSequence  =  1  
	   	  HEXcode  =  Right("00000000"  &  Hex(TextNumber), 8)  
	   	  for p  =  1 To 7 Step 2  
	   	   	  VarTextNumber  =  VarTextNumber  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	  next  
	   	  HEXcode  =  right ( "00000000"  &  HEX ( TextSequence ) , 8 )  
	   	  for p  =  1 to 7 Step 2  
	   	   	  VarTextSequence  =  VarTextSequence  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	  next  
	   	  i  =  1  
	   	  PrevPos  =  i  
	   	  NumOfCharacters  =  0  
	   	  Do while i  <=  TextLength  
	   	   	  '  |  TextBox needs to be split in multiple text lines  
	   	   	  TextCharacter  =  MID(Texts.Text ,i,1)  
	   	   	  if (NumOfCharacters  >=  240) then  
	   	   	   	  '  |  Create current text as a sequence line.  
	   	   	   	  TextString  =  TextString  +  EndTextString  
	   	   	   	  dump 1  	  '  |   **  TTTXT010  	   
	   	   	   	   
	   	   	   	  '  |  reset fields for next text sequence line.  
	   	   	   	  TextString  =  ""  	   	   	   
	   	   	   	  VarTextNumber  =  ""  	   	   	   
	   	   	   	  VarTextSequence  =  ""  	   	   
	   	   	   	  TextSequence  =  TextSequence  +  1  
	   	   	   	  PrevPos  =  i  
	   	   	   	  NumOfCharacters  =  0  
	   	   	   	   
	   	   	   	  HEXcode  =  Right("00000000"  &  Hex(TextNumber), 8)  
	   	   	   	  for p  =  1 To 7 Step 2  
	   	   	   	   	  VarTextNumber  =  VarTextNumber  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	   	   	  next  
	   	   	   	  HEXcode  =  right ( "00000000"  &  HEX ( TextSequence ) , 8 )  
	   	   	   	  for p  =  1 to 7 Step 2  
	   	   	   	   	  VarTextSequence  =  VarTextSequence  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	   	   	  next  
	   	   	  end if  
	   	   
	   	   	   
	   	   	  '  |  Check for Enter in text  
	   	   	  if (ASC (TextCharacter)  =  13) then  
	   	   	   	  TextCharacter  =  CHR(10)  	   	   	   
	   	   	   	  i  =  i  +  2  
	   	   	  else  
	   	   	   	  TextCharacter  =  TextCharacter  	   	   
	   	   	   	  i  =  i  +  1  
	   	   	  end if  
	   	   	  '  |  Check for TAB in text  
	   	   	  if (ASC (TextCharacter)  =  9) then  
	   	   	   	  CHRspace  =  CHR (32)  
	   	   	   	  TextCharacter  =  ""  	   	   	   	   	   	   	   
	   	   	   	  for p  =  1 to 6  	   	  '  |  Replace TAB with 6 spaces  	   	   	   	   
	   	   	   	   	  TextCharacter  =  TextCharacter  +  CHRspace  	   	   	   
	   	   	   	  next  	   
	   	   	   	  NumOfCharacters  =  NumOfCharacters  +  5  	   	   	   	   	   
	   	   	  end if  	   
	   	   	  TextString  =  TextString  +  TextCharacter  
	   	   	  NumOfCharacters  =  NumOfCharacters  +  1  
	   	  loop  
	   	   
	   	  '  |  Text line is maximum of 239 and fits in 1 text line  
	   	  TextString  =  TextString  +  CHR (10) '  |  Close Character of the string  
	   	   	   	   	   
	   	  '  |  Fill up the remainder of the string with spaces  
	   	  '  |  240  =  NumOfCharacters  +  Close chararter  +  NrOfSpaces  
	   	  NrOfSpaces  =  239  -  NumOfCharacters  	   	   	   	   
	   	  CHRspace  =  CHR ( 32 )  	   	   	   	   	   	   	   	   	   
	   	  for p  =  1 to NrOfSpaces  	   	   	   	   	   	   	   	   
	   	   	  TextString  =  TextString  +  CHRspace  	   	   	   	   
	   	  next  	   	   	   	   	   	   	   	   
	   	   	   	   	   	   	   	   
	   	  TextString  =  TextString  +  EndTextString  
	   	   
	   	  dump 1  	   	  '  |   **  TTTXT010  
	   	  TextString  =  ""  	   	   	   	   	   	   	   
	   	  VarTextNumber  =  ""  	   	   	   	   	   	   	   
	   	  VarTextSequence  =  ""  	   	   	   	   	   	   
	   	  dump 2  	   	  '  |   **  TTTXT002  
	   	  dump 3  	   	  '  |   **  TTTXT001  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:S
:QURY:START
select  	  Texts.*
from 	  Texts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:wh
:TCMOD:inh
:TFLNO:520
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AdjustmentOrders
:ICOD:D
:QURY:START
	  varstr.cwar  =  AdjustmentOrders.Warehouse  
	  varstr.item  =  AdjustmentOrders.Item  
	  varstr.cprj  =  AdjustmentOrders.Project  
	  varstr.temp  =  read.item.settings(varstr.item, varstr.cprj, var.location.controlled, var.lot.controlled, var.serialized, var.lots.in.inv, var.serials.in.inv)  
	  If AdjustmentOrders.Warehouse  <>  prev.warehouse then  
	   	  varint.position  =  10  
	   	  varint.counter  =  varint.counter  +  1  
	   	  varstr.order.number  =  generate.order.number(varstr.series, varint.counter)  
	   	  dump 520 '  |  Adjustment Order Headers  
	  End If  
	  '  |   *  The 'Inventory Price' check box is only available if both of the following conditions apply:  
	   	  '  |  1  -  The adjustment  -  order line concerns a positive variance.  
	   	  '  |  2  -  The item's inventory  -  valuation method is not 'Fixed Transfer Price (FTP)' (whwmd210.valm).  
	  varint.valm  =  get.inventory.valuation.method(varstr.cwar, varstr.cprj, varstr.item)  
	  if varint.valm  <>  1 then  
	   	  var.adjustment.price  =  AdjustmentOrders.AdjustmentPrice  
	  else  
	   	  var.adjustment.price  =  0  
	  end if  
	  if var.adjustment.price  =  0 or IsNull(var.adjustment.price) then  
	   	  var.use.price  =  2  	  '  |  No  
	  else  
	   	  var.use.price  =  1  	  '  |  Yes  
	  end if  
	  '  |   *  Determine if Location is permitted for this item  
	  varstr.location  =  AdjustmentOrders.Location  
	  if var.location.controlled  =  2 then  
	   	  varstr.location  =  ""  
	  end if  
	  '  |   *  Determine if Lot is permitted for this item  
	  '  |   *  The field 'Lots in Inventory' (whwmd400.linv) is always set to "yes" in case of a Lot Controlled item.  
	  '  |   *  That means it is mandatory to fill a Lot in whinh521  !   
	  varstr.clot  =  AdjustmentOrders.Lot  
	  if var.lot.controlled  =  2 then  	   
	   	  var.whinh521.clot  =  ""  
	  else  
	   	  var.whinh521.clot  =  varstr.clot  	   	   
	  end if  
	  '  |  Ownership variables non  -  serialized items  
	  var.whinh521.istr  =  90 '  |  Not Applicable  
	  var.whinh521.iown  =  90 '  |  Not Applicable  
	  var.whinh521.dpby  =  90 '  |  Not Applicable  
	  varstr.serial  =  AdjustmentOrders.SerialNumber  
	  if var.serialized  =  1 and trim(varstr.serial)  <>  "" then  
	   	  '  |   *  The Lot field in table whinh526 (Adjustment Order Line Lots and Serials) is only applicable in case the setting 'Lots in Inventory' is not set (whwmd400.linv)  !   
	   	  '  |   *  In case of a Serialized item you have to enter the serial numbers (must be unique  !  ) in table whinh526.  
	   	  if var.lots.in.inv  =  1 then  
	   	   	  var.whinh521.clot  =  varstr.clot  
	   	   	  var.whinh526.clot  =  ""  
	   	  else  
	   	   	  var.whinh521.clot  =  ""  
	   	   	  var.whinh526.clot  =  varstr.clot  
	   	  end if  
	   	  if var.serials.in.inv  =  1 then  
	   	   	  var.whinh526.stat  =  1  	  '  |  Initial  
	   	  else  	   
	   	   	  var.whinh526.stat  =  20  	  '  |  Not Applicable  
	   	  end if  
	   	   
	   	  if (varstr.cwar  =  prev.warehouse) and (varstr.cprj  <>  prev.project or varstr.item  <>  prev.item) then  
	   	   	  var.quantity  =  determine.total.line.quantity(varstr.cwar, varstr.cprj, varstr.item)  
	   	   	  if var.serials.in.inv  =  1 then  
	   	   	   	  var.whinh521.istr  =  10 '  |  Free  
	   	   	   	  var.whinh521.iown  =  10 '  |  Company Owned or Consigned  
	   	   	   	  var.whinh521.dpby  =  20 '  |  Own Company  
	   	   	  end if  
	   	   	  varint.position  =  varint.position  +  10  
	   	   	  dump 521 '  |  Adjustment Order Line  
	   	  end if  
	   	  if varint.position  =  prev.position then  
	   	   	  var.whinh526.dssq  =  var.whinh526.dssq  +  1  
	   	  else  
	   	   	  var.whinh526.dssq  =  1  
	   	  end if  
	   	  dump 526 '  |  Adjustment Order Line Lots and Serials  
	  else  
	   	  var.quantity  =  AdjustmentOrders.Quantity  
	   	  If AdjustmentOrders.Warehouse  =  prev.warehouse then  
	   	   	  varint.position  =  varint.position  +  10  
	   	  End If  
	   	  if var.lots.in.inv  =  2 and var.lot.controlled  =  1 and trim(varstr.clot)  <>  "" then  
	   	   	  '  |  When 'Lots in inventory' is 'no' and items is not serialized then always 1 line in whinh526 to register the lot  
	   	   	  '  |  and the Lot field in whinh521 must be empty.  
	   	   	  var.whinh521.clot  =  ""  
	   	   	  var.whinh526.clot  =  varstr.clot  
	   	   	  var.whinh526.stat  =  20  
	   	   	  var.whinh526.dssq  =  1  
	   	   	  dump 526 '  |  Adjustment Order Line Lots and Serials  
	   	  end if  
	   	  dump 521 '  |  Adjustment Order Line  
	  end if  
	  prev.warehouse  	   =  AdjustmentOrders.Warehouse  
	  prev.project  	   =  AdjustmentOrders.Project  
	  prev.item  	   	   =  AdjustmentOrders.Item  
	  prev.position  	   =  varint.position  
	  '  |   *  COMMENTS  
	  '  |   *  It is not necessary to fill table whinh525 (Adjustment Order Line Ownership)  
	  '  |   *  because this table will be automatically filled by the system as soon as the adjustment orders will be processed.  
	
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:wh
:TCMOD:inh
:TFLNO:520
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AdjustmentOrders
:ICOD:S
:QURY:START
select AdjustmentOrders.*
from 	  AdjustmentOrders
order by AdjustmentOrders.Warehouse, AdjustmentOrders.Project, AdjustmentOrders.Item, AdjustmentOrders.Lot, AdjustmentOrders.SerialNumber
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:wh
:TCMOD:inh
:TFLNO:520
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AdjustmentOrders
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:D
:QURY:START
	  var.whltc100.ldat  =  LotsByItem.LotDate  
	  if var.whltc100.ldat  =  "" or IsNull(var.whltc100.ldat) then  
	   	  var.whltc100.ldat  =  Date()  
	  end if  
	  dump 100 '  |  Lots
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:S
:QURY:START
select  	  LotsByItem.*
from 	  LotsByItem
order by LotsByItem.Project, LotsByItem.Item, LotsByItem.Lot
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:D
:QURY:START
	  varstr.cprj  =  WarehouseItem.Project  
	  varstr.item  =  WarehouseItem.Item  
	  var.whwmd210.ialt  =  20  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select Items.LocationControlled  
	   	  from Items  
	   	  where Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  If Items.Project  =  "" or IsNull(Items.Project) then  
	   	   	   	  If Items.LocationControlled  =  1 then  
	   	   	   	   	  var.whwmd210.ialt  =  5  
	   	   	   	  else  
	   	   	   	   	  var.whwmd210.ialt  =  20  
	   	   	   	  End If  
	   	   	  End If  
	   	  endselect  
	  else  
	   	  select Items.LocationControlled  
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj  
	   	  and  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  if Items.LocationControlled  =  1 then  
	   	   	   	  var.whwmd210.ialt  =  5  
	   	   	  else  
	   	   	   	  var.whwmd210.ialt  =  20  
	   	   	  end if  
	   	  endselect  
	  end if  
	   
	  if (WarehouseItem.OrderQuantityIncrement  <=  "0") then  
	   	  var.oqmf  =  1  
	  else  
	   	  var.oqmf  =  WarehouseItem.OrderQuantityIncrement  
	  end if  
	  if (WarehouseItem.MinimumOrderQuantity  <=  "0") then  
	   	  var.mioq  =  1  
	  else  
	   	  var.mioq  =  WarehouseItem.MinimumOrderQuantity  
	  end if  
	  if (WarehouseItem.MaximumOrderQuantity  <=  "0") then  
	   	  var.maoq  =  9999999  
	  else  
	   	  var.maoq  =  WarehouseItem.MaximumOrderQuantity  
	  end if  
	  if (WarehouseItem.FixedOrderQuantity  <=  "0") then  
	   	  var.fioq  =  1  
	  else  
	   	  var.fioq  =  WarehouseItem.FixedOrderQuantity  
	  end if  
'  	  if (Warehouse_Item.EconomicOrderQuantity  <=  "0") then  	   |   #  253844.so  
'  	   	  var.ecoq  =  1  
'  	  else  
'  	   	  var.ecoq  =  Warehouse_Item.EconomicOrderQuantity  
'  	  end if  	   	   	   	   	   	   	   |   #  253844.eo  
	  if (WarehouseItem.EconomicOrderQuantity  <=  "0") then  	  '  |   #  253844.sn  
	   	  var.ecoq  =  1  
	  else  
	   	  var.ecoq  =  WarehouseItem.EconomicOrderQuantity  
	  end if  
	   	   	   	   	   	   	  '  |   #  253844.en  
	  var.whwmd210.srpr  =  2  
	  if (WarehouseItem.InventoryValuationMethod)  =  6 then  
	   	  var.whwmd210.srpr  =  1  
	  end if  
	  dump 210  	  '  |   *  whwmd210  -  Warehouse Item Data  
	  dump 215  	  '  |   *  whwmd215  -  Item Inv by Warehouse  
	  dump 216  	  '  |   *  whwmd216  -  Inv by warehouse, item , eff unit
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:S
:QURY:START
select  	  WarehouseItem.*
from 	  WarehouseItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:8
:VERS:A2LN
:RELE:a8
:CUST:fp8
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:D
:QURY:START
	  var.bpmdm001.sdte  =  get.date(EmployeesPeople.FirstDateEmployment,"yes")  
	  var.bpmdm001.edte  =  get.date(EmployeesPeople.LastDateEmployment,"no")  
	  var.bpmdm001.daob  =  get.date(EmployeesPeople.DateBirth,"no")  
	  dump 001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:S
:QURY:START
select EmployeesPeople.*
from EmployeesPeople
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:cp
:TCMOD:rpd
:TFLNO:320
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfCriticalMaterials
:ICOD:D
:QURY:START
	  var.cprpd320.indt  =  get.utc(BillOfCriticalMaterials.EffectiveDate, "yes")  
	  var.cprpd320.exdt  =  get.utc(BillOfCriticalMaterials.ExpiryDate, "no")  
'  |   
'  |  Sequence number can now be filled via the Access table  	   
'  	  If Hold.PlanItem  =  BillOfCriticalMaterials.PlanItem then  
'  	   	  var.cprpd320.sern  =  var.cprpd320.sern  +  1  
'  	  else  
'  	   	  var.cprpd320.sern  =  1  
'  	  end if  	   
' Hold.PlanItem  =  BillOfCriticalMaterials.PlanItem  
'  |   
dump 320
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:cp
:TCMOD:rpd
:TFLNO:320
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfCriticalMaterials
:ICOD:S
:QURY:START
select BillOfCriticalMaterials.*
from BillOfCriticalMaterials
order by BillOfCriticalMaterials.PlanItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:cp
:TCMOD:rpd
:TFLNO:320
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfCriticalMaterials
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:D
:QURY:START
	  var.cprpd710.effd  =  get.utc(SourcingStrategies.EffectivityDate, "yes")  
	  var.cprpd710.expd  =  get.utc(SourcingStrategies.ExpiryDate, "no")  	   
dump 710
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:S
:QURY:START
select SourcingStrategies.*
from SourcingStrategies
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:D
:QURY:START
	  varstr.bp  =  BusinessPartner.BusinessPartner  
	  CustomerRoles  =  0  
	  SupplierRoles  =  0  
	  if BusinessPartner.SearchKey  <>  "" then  
	   	  var.tccom100.seak  =  UCase(Left(BusinessPartner.SearchKey,16))  
	  else  
	   	  var.tccom100.seak  =  UCase(Left(BusinessPartner.Name,16))  
	  end if  
	  var.tccom100.stdt  =  get.utc(BusinessPartner.StartDate, "no")  
	  if BusinessPartner.SoldTo  =  1 then  
	   	  CustomerRoles  =  1  
	   	  dump 110 '  |   #  tccom110  
	  end if  
	  if BusinessPartner.ShipTo  =  1 then  
	   	  if Trim(BusinessPartner.ShipToAddress)  <>  "" then  
	   	   	  varstr.address  =  BusinessPartner.ShipToAddress  
	   	  else  
	   	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  end if  
	   	  CustomerRoles  =  1  
	   	  dump 111 '  |   #  tccom111  
	  end if  
	  if BusinessPartner.InvoiceTo  =  1 then  
	   	  if Trim(BusinessPartner.InvoiceToAddress)  <>  "" then  
	   	   	  varstr.address  =  BusinessPartner.InvoiceToAddress  
	   	  else  
	   	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  end if  
	   	  CustomerRoles  =  1  
	   	  var.tccom112.edci  =  get.utc(BusinessPartner.ExpiryDateInsuredCredit,"no")  
	   	  dump 112 '  |   #  tccom112  
	  end if  
	  if BusinessPartner.PayBy  =  1 then  
	   	  CustomerRoles  =  1  
'  |  243210.sn  
	   	  var.tccom114.cban  =  ""  
	   	  select BankAccountsByPayByBP.*   
	   	  from BankAccountsByPayByBP  
	   	  where BankAccountsByPayByBP.PayByBusinessPartner  =  varstr.bp  
	   	  order by BankAccountsByPayByBP.BankAccountCode desc  
	   	  selectdo  
	   	   	  var.tccom114.cban  =  BankAccountsByPayByBP.BankAccountCode  
	   	  endselect  
'  |  243210.en  
	   	  dump 114 '  |   #  tccom114  
	  end if  
	  if BusinessPartner.BuyFrom  =  1 then  
	   	  SupplierRoles  =  1  
	   	  dump 120 '  |   #  tccom120  
	  end if  
	  if BusinessPartner.ShipFrom  =  1 then  
	   	  SupplierRoles  =  1  
	   	  dump 121 '  |   #  tccom121  
	  end if  
	  if BusinessPartner.InvoiceFrom  =  1 then  
	   	  SupplierRoles  =  1  
'  |  FP7.sn  	   	   
	   	  var.tccom122.cadr  =  BusinessPartner.AddressCode  
	   	  var.tccom122.rtyp  =  BusinessPartner.ExchangeRateType  
	   	  var.tccom122.crlr  =  BusinessPartner.CreditLimit  
	   	  if Not IsNull(BusinessPartner.CreditLimit) then  
	   	   	  var.tccom122.crlr  =  BusinessPartner.CreditLimit  
	   	  else  
	   	   	  var.tccom122.crlr  =  0.0  
	   	  end if  	   	   	   
	   	  var.tccom122.cpay  =  BusinessPartner.TermsPayment  
	   	  var.tccom122.ccrs  =  BusinessPartner.LatePaymentSurcharge  
	   	  var.tccom122.paym  =  BusinessPartner.PaymentMethod  
	   	  varstr.businesspartner  =  BusinessPartner.BusinessPartner  
	   	  select BusinessPartnerExtension.*   
	   	  from BusinessPartnerExtension  
	   	  where BusinessPartnerExtension.BusinessPartner  =  varstr.businesspartner  
	   	  selectdo  
	   	   	  if BusinessPartnerExtension.AddressCodeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.cadr  =  BusinessPartnerExtension.AddressCodeInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.ExchangeRateTypeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.rtyp  =  BusinessPartnerExtension.ExchangeRateTypeInvFrom  
	   	   	  end if  	   	   
	   	   	  if Not IsNull(BusinessPartnerExtension.CreditLimitInvFrom) then  
	   	   	   	  var.tccom122.crlr  =  BusinessPartnerExtension.CreditLimitInvFrom  
	   	   	  end if  	   	   
	   	   	  if BusinessPartnerExtension.TermsPaymentInvFrom  <>  "" then  
	   	   	   	  var.tccom122.cpay  =  BusinessPartnerExtension.TermsPaymentInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.LatePaymentSurchargeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.ccrs  =  BusinessPartnerExtension.LatePaymentSurchargeInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.PaymentMethodInvFrom  <>  "" then  
	   	   	   	  var.tccom122.paym  =  BusinessPartnerExtension.PaymentMethodInvFrom  
	   	   	  end if  
	   	  endselect  
|  FP7.en  
	   	  dump 122 '  |   #  tccom122  
	  end if  
	  if BusinessPartner.PayTo  =  1 then  
	   	  SupplierRoles  =  1  
'  |   *  Determine Bank Code  
'  |   *   #  42.sn  
	   	  var.tccom124.cban  =  ""  
	   	  select BankAccountsByPayToBP.*   
	   	  from  	  BankAccountsByPayToBP  
	   	  where BankAccountsByPayToBP.PayToBusinessPartner  =  varstr.bp  
	   	  order by BankAccountsByPayToBP.BankAccountCode desc  
	   	  selectdo  
	   	   	  var.tccom124.cban  =  BankAccountsByPayToBP.BankAccountCode  
	   	  endselect  
'  |   *   #  42.en  
	   	  dump 124 '  |   #  tccom124  
	  end if  
	  if CustomerRoles  =  0 then  
	   	  if SupplierRoles  =  0 then  
	   	   	  var.tccom100.bprl  =  1  
	   	  else  
	   	   	  var.tccom100.bprl  =  3  
	   	  end if  
	  else  
	   	  if SupplierRoles  =  0 then  
	   	   	  var.tccom100.bprl  =  2  
	   	  else  
	   	   	  var.tccom100.bprl  =  4  
	   	  end if  
	  end if  
	  dump 100 '  |   #  tccom100  
	  If BusinessPartner.TaxNumber  <>  "" then  
	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  var.tctax400.ccty  =  ""  
	   	  select  	  Addresses.*   
	   	  from  	  Addresses  
	   	  where  	  Addresses.AddressCode  =  varstr.address  
	   	  selectdo  
	   	   	  var.tctax400.ccty  =  Addresses.Country  
	   	  endselect  
	   	  dump 400 '  |   #  tctax400  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:S
:QURY:START
select  	  BusinessPartner.*
from 	  BusinessPartner
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:D
:QURY:START
	  if Addresses.SearchKey  <>  "" then  
	   	  var.tccom130.seak  =  Ucase(Left(Addresses.SearchKey,16))  
	  else  
	   	  var.tccom130.seak  =  Ucase(Left(Addresses.Name,16))  
	  end if  
'  |  Determine default messaging method  
'  |  SITA not used  
	  var.tccom130.defa  =  10  
'target(tccom.defa.not.applicable)  
	  if Addresses.SMSNumber  <>  "" then  
	   	  var.tccom130.defa  =  5 'to.target(tccom.defa.sms)  
	  end if  
	  if Addresses.Telex  <>  "" then  
	   	  var.tccom130.defa  =  3 ' to.target(tccom.defa.telex)  
	  end if  
	  if Addresses.Fax  <>  "" then  
	   	  var.tccom130.defa  =  2' to.target(tccom.defa.fax)  
	  end if  
	  if Addresses.Email  <>  "" then  
	   	  var.tccom130.defa  =  1 ' to.target(tccom.defa.email)  
	  end if  
	  if len(trim(Addresses.Telephone))  >  0 then  
	   	  var.tccom130.defa  =  6 ' to.target(tccom.defa.phone)  
	  end if  
'  |  end determine defa  
	  dump 130 '  |   #  tccom130  
'  
	  if len(trim(Addresses.ZipPostalCode))  >  0 then  
	   	  if var.country  <>  trim(Addresses.Country) or _  
	   	  var.zipcode  <>  trim(Addresses.ZipPostalCode) then  
	   	   	  var.country  =  trim(Addresses.Country)  
	   	   	  var.zipcode  =  trim(Addresses.ZipPostalCode)  
	   	   	  dump 136 '  |   #  tccom136  
	   	  end if  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:S
:QURY:START
select Addresses.*
from Addresses
order by Addresses.Country, Addresses.ZipPostalCode
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:com
:TFLNO:139
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:D
:QURY:START
	  if not ISNULL(Addresses.City) then  
	   	  var.tccom139.city  =  Ucase(trim(Left(Addresses.City, 8)))  
'  	   	  if prev.city  <>  var.tccom139.city then  
	   	  if ((prev.city  <>  var.tccom139.city) or (prev.country  <>  trim(Addresses.Country)) or (prev.stateprovince  <>  trim(Addresses.StateProvince))) then  
	   	   	   	  prev.city  =  var.tccom139.city  
	   	   	   	  prev.country  =  trim(Addresses.Country)  
	   	   	   	  prev.stateprovince  =  trim(Addresses.StateProvince)  
	   	   	   	  var.tccom139.idnr  =  var.tccom139.idnr  +  1  
	   	   	   	  If Addresses.CityDescription  =  "" or IsNull(Addresses.CityDescription) then  
	   	   	   	   	  var.tccom139.dsca  =  trim(Left(Addresses.City,30))  
	   	   	   	  else  
	   	   	   	   	  var.tccom139.dsca  =  trim(Left(Addresses.CityDescription,30))  
	   	   	   	  End If  
	   	   	   	  If Addresses.SearchKey  =  "" or IsNull(Addresses.SearchKey) then  
	   	   	   	   	  var.tccom139.seak  =  Ucase(trim(Left(Addresses.City, 16)))  
	   	   	   	  else  
	   	   	   	   	  var.tccom139.seak  =  Ucase(trim(Left(Addresses.SearchKey, 16)))  
	   	   	   	  End If  	   	   
	   	   	   	   
	   	   	   	  dump 139  
	   	  end if  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:com
:TFLNO:139
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:S
:QURY:START
select Addresses.*
from Addresses
where Addresses.City  <>  ""
order by Addresses.Country, Addresses.StateProvince, Addresses.City
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:com
:TFLNO:139
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:D
:QURY:START
	  if trim(Contacts.SearchKey)  <>  "" then  
'  |   	   	  var.tccom140.seak  =  Ucase(Left(Contact.SearchKey,16)) '  |   *  249609.o  
	   	  var.tccom140.seak  =  Ucase(Left(Contacts.SearchKey,16)) '  |   *  249609.n  
	  else  
	   	  var.tccom140.seak  =  Ucase(Left(Contacts.FamilyName, 16))  
	  end if  
	   
	  var.tccom140.fuln  =  trim (Contacts.GivenName)  &  " "  &  trim(Contacts.MiddleName)  &  " "  &  trim(Contacts.FamilyName)  
	   
	  var.tccom140.bthd  =  get.date(Contacts.BirthDay,"no")  
	  var.tccom140.pelp  =  2  
	  var.tccom140.peld  =  2  
	  var.tccom140.pehm  =  2  
	  var.tccom140.pelm  =  2  
	  if trim (Contacts.Telephone)  <>  "" then  
	   	  var.tccom140.pelp  =  1 '  |  yes if Office phone filled  
	  else  
	   	  if trim (Contacts.Cellphone)  <>  "" then  
	   	   	  var.tccom140.pelm  =  1 '  |  yes If Mobile phone is filled  
	   	  else  
	   	   	  if trim (Contacts.PhonePrivate)  <>  "" then  
	   	   	   	  var.tccom140.pehm  =  1 '  |  yes If private phone is filled  
	   	   	  else  
	   	   	   	  if trim (Contacts.DirectDial)  <>  "" then  
	   	   	   	   	  var.tccom140.peld  =  1 '  |  yes If Direct Dial is filled  
	   	   	   	  end if  
	   	   	  end if  
	   	  end if  	   
	  end if  	   
	  dump 140  	  '  |   #  tccom140
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:S
:QURY:START
select Contacts.*
from Contacts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:D
:QURY:START
'  |   **********************************************************************************************   
'  |  Function Flow  
'  |  1  -  Setting of some global variables.  
'  |  2  -  For each dump table  
'  |   	   	  a  -  Handle defaulting fields not in the item access table  
'  |   	   	  b  -  Handle defaulting fields als in item access table  
'  |   	   	  c  -  All other variables for the dump table are set.  
'  |   	   	  Based upon specific values in the Item Access table a variable is set which is  
'  |   	   	  used in the dumps.  
'  |  3  -  Dump section for all tables.  
'  |   	   
'  |   **********************************************************************************************   
	  varstr.cprj  	   	   =  Items.Project  
	  varstr.item  	   	   =  Items.Item  
	  varstr.itemgroup  	   =  Items.ItemGroup  	   	   	   	   
	  varint.itemtype  	   =  Items.ItemType  
	  if Items.Exception  =  0 then  
	   	  Items.Exception  =  1  
	  end if  	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for General Data (tcibd001)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsGeneral.*   
	  from  	   	  ItemDefaultsGeneral  
	  where  	   	  ItemDefaultsGeneral.kitm  =  varint.itemtype And ItemDefaultsGeneral.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tcibd001.exin  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.exin, "", Items.Exception, DefaultFound)  
	   
	  var.tcibd001.chma  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.chma, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.cnfg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.cnfg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.dpcr  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpcr, 0, Items.Exception, DefaultFound, 100)  
	  var.tcibd001.dpeg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpeg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.dptp  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dptp, 0, Items.Exception, DefaultFound, 90)  
	  var.tcibd001.dpuu  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpuu, 0, Items.Exception, DefaultFound, 2)  	   	   
	  var.tcibd001.edco  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.edco, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.eitm  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.eitm, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.icsi  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.icsi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tcibd001.itmt  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.itmt, 0, Items.Exception, DefaultFound, 10)  
	  var.tcibd001.ippg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ippg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.mcoa  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.mcoa, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.ppeg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ppeg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.psiu  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.psiu, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.sayn  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.sayn, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.styp  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.styp, 0, Items.Exception, DefaultFound, 1)  
	  var.tcibd001.subc  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.subc, 0, Items.Exception, DefaultFound, 2)  
	   
	  'Defaults presents and present in Item access table  
	  var.tcibd001.ccde  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ccde, Items.CommodityCode, Items.Exception, DefaultFound)  
	  var.tcibd001.cean  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cean, Items.EANCode, Items.Exception, DefaultFound)  
	  var.tcibd001.cmnf  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cmnf, Items.Manufacturer, Items.Exception, DefaultFound)  
	  var.tcibd001.cood  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cood, Items.TechnicalCoordinator, Items.Exception, DefaultFound)  
	  var.tcibd001.cpcl  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpcl, Items.ProductClass, Items.Exception, DefaultFound)  
	  var.tcibd001.cpcp  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpcp, Items.CostComponent, Items.Exception, DefaultFound)  
	  var.tcibd001.cpln  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpln, Items.ProductLine, Items.Exception, DefaultFound)  
	  var.tcibd001.csel  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.csel, Items.SelectionCode, Items.Exception, DefaultFound)  
	  var.tcibd001.csig  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.csig, Items.ItemSignal, Items.Exception, DefaultFound)  
	  var.tcibd001.ctyo  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ctyo, Items.CountryOrigin, Items.Exception, DefaultFound)  
	  var.tcibd001.ctyp  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ctyp, Items.ProductType, Items.Exception, DefaultFound)  
	  var.tcibd001.cuni  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cuni, Items.InventoryUnit, Items.Exception, DefaultFound)  
	  var.tcibd001.dscb  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscb, Items.Material, Items.Exception, DefaultFound)  
	  var.tcibd001.dscc  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscc, Items.Size, Items.Exception, DefaultFound)  
	  var.tcibd001.dscd  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscd, Items.Standard, Items.Exception, DefaultFound)  
	  var.tcibd001.uset  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.uset, Items.UnitSet, Items.Exception, DefaultFound)  
	  var.tcibd001.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.txta, Items.TextIDGeneral, Items.Exception, DefaultFound)  
	  if Items.WeightUnit  =  "" then  
	   	  var.tcibd001.cwun  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cwun, var.weight.unit, Items.Exception, DefaultFound)  
	   	  var.tcibd001.wght  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.wght, 0, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd001.cwun  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cwun, Items.WeightUnit, Items.Exception, DefaultFound)  
	   	  var.tcibd001.wght  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.wght, Items.Weight, Items.Exception, DefaultFound)  
	  end if  
	  var.tcibd001.srce  =  DetermineSrce(Items.ItemType)  
	  var.tcibd001.srce  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.srce, var.tcibd001.srce, Items.Exception,DefaultFound, 10)  
'  |   **********************************************************************************************   
'  |  In case of Lot Controlled (tcibd001)  	   	   
'  |   **********************************************************************************************   
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tcibd001.ltct  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ltct, Items.LotControlled, Items.Exception, DefaultFound, 2)  
	  else  
	   	  var.tcibd001.ltct  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ltct, 2, Items.Exception, DefaultFound, 2)  
	  end if  
	   
'  |   **********************************************************************************************   
'  |  In case of Serialized Items (tcibd001)  
'  |   **********************************************************************************************   
	  If Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tcibd001.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.seri, Items.Serialized, Items.Exception, DefaultFound, 2)  	   
	  else  
	   	  var.tcibd001.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.seri, 2, Items.Exception, DefaultFound, 2)  	   	   
	  end if  
	   	   
'  |   **********************************************************************************************   
'  |  Settings for General Item data (tcibd001)  
'  |   **********************************************************************************************   
	  if Items.SearchKeyI  <>  "" then  
	   	  var.tcibd001.seak  =  UCase(Left(Items.SearchKeyI, 16))  
	  else  
	   	  var.tcibd001.seak  =  UCase(Left(Items.ItemDescription, 16))  
	  end if  
	   
	  if Items.SearchKeyII  <>  "" then  
	   	  var.tcibd001.seab  =  UCase(Left(Items.SearchKeyII, 16))  
	  else  
	   	  var.tcibd001.seab  =  UCase(Left(Items.Item, 16))  
	  end if  
	   
'  |   **********************************************************************************************   
'  |  Settings for Alternative Items (tcibd001)  
'  |   **********************************************************************************************   
	  var.tcibd001.repl  =  5  	   	   	   	   	   	  '  |  Not Applicable  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where ( AlternativeItems.Project  =  "" and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  10  	   	   	   	  '  |  Replaced  
	   	  endselect  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  "" and AlternativeItems.AlternativeItem  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  15  	   	   	   	  '  |  Substitute  
	   	  endselect  
	  else  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  varstr.cprj and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  10  	   	   	   	  '  |  Replaced  
	   	  endselect  
	  end if  
	   
	   
	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Costing Data (ticpr007)  
'  |   **********************************************************************************************   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsCosting.*   
	  from  	  ItemDefaultsCosting  
	  where  	  ItemDefaultsCosting.kitm  =  varint.itemtype And ItemDefaultsCosting.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.ticpr007.chrt  =  ItemHandling.GetTypeString(ItemDefaultsCosting.chrt, "", Items.Exception, DefaultFound)  	   
	  var.ticpr007.lcst  =  ItemHandling.GetTypeString(ItemDefaultsCosting.lcst, "", Items.Exception, DefaultFound)  
	  var.tcibd007.inlc  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.inlc, 0, Items.Exception, DefaultFound, 2)  
	   
	  'Defaults presents and present in Item access table  
	  var.tcibd007.acpm  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpm, Items.AggregatedMaterialCostCompo, Items.Exception, DefaultFound)  
	  var.tcibd007.ccur  =  ItemHandling.GetTypeString(ItemDefaultsCosting.ccur, Items.CostingCurrency, Items.Exception, DefaultFound)  
	  var.tcibd007.spit  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.spit, Items.SurchargesbyItem, Items.Exception, DefaultFound, 2)  
	  var.tcibd007.vpwh  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.vpwh, Items.SurchargesbyWarehouse, Items.Exception, DefaultFound, 2)  
	   
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tcibd007.acpo  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpo, Items.AggregatedOperationCostComp, Items.Exception, DefaultFound)  
	   	  var.tcibd007.acps  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acps, Items.AggregatedSurchargeCostComp, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd007.acpo  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpo, "", Items.Exception, DefaultFound)  
	   	  var.tcibd007.acps  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acps, "", Items.Exception, DefaultFound)  
	  end if  
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Purchase Data (tdipu001)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsPurchase.*   
	  from  	  ItemDefaultsPurchase  
	  where  	  ItemDefaultsPurchase.kitm  =  varint.itemtype And ItemDefaultsPurchase.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  	   
	   
	  'Defaults presents but not in Item access table  	   
	  var.tdipu001.rtdm  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtdm, 0, Items.Exception, DefaultFound)  
	  var.tdipu001.rtdp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtdp, 0, Items.Exception, DefaultFound)  	   
	  var.tdipu001.rtqm  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtqm, 0, Items.Exception, DefaultFound)  
	  var.tdipu001.rtqp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtqp, 0, Items.Exception, DefaultFound)  
	   
	  var.tdipu001.acci  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.acci, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.casl  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.casl, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.cims  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.cims, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.hstq  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.hstq, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.hstd  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.hstd, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.issp  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.issp, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.mmnf  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.mmnf, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.mpyn  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.mpyn, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tdipu001.rqms  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.rqms, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.qual  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.qual, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.vryn  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.vryn, 0, Items.Exception, DefaultFound, 1)  
	   
	  'Defaults presents and present in Item access table  
	  var.tdipu001.buyr  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.buyr, Items.Buyer, Items.Exception, DefaultFound)  
	  var.tdipu001.ccur  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.ccur, Items.PurchaseCurrency, Items.Exception, DefaultFound)  
	  var.tdipu001.cofc  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cofc, Items.PurchaseOffice, Items.Exception, DefaultFound)  
	  var.tdipu001.cpgp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cpgp, Items.PurchasePriceGroup, Items.Exception, DefaultFound)  
	  var.tdipu001.csgp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.csgp, Items.PurchaseStatisticsGroup, Items.Exception, DefaultFound)  
	  var.tdipu001.cupp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cupp, Items.PurchasePriceUnit, Items.Exception, DefaultFound)  
	  var.tdipu001.cuqp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cuqp, Items.PurchaseUnit, Items.Exception, DefaultFound)  
	  var.tdipu001.cvat  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cvat, Items.TaxCodePurchase, Items.Exception, DefaultFound)  
	  var.tdipu001.otbp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.otbp, Items.BuyFromBusinessPartner, Items.Exception, DefaultFound)  
	  var.tdipu001.txtp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.txtp, Items.TextIDPurchase, Items.Exception, DefaultFound)  
	   
	  If Items.ItemType  =  4 then  
	   	  var.tdipu001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.retw, 2, Items.Exception, DefaultFound, 1)  
	   	  var.tdipu001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cwar, "", Items.Exception, DefaultFound)  
	  else  
	   	  var.tdipu001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.retw, 1, Items.Exception, DefaultFound, 1)  
	   	  var.tdipu001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cwar, Items.Warehouse, Items.Exception, DefaultFound)  
	  end if  
	   
	  If Items.SupplyTime  <  "0" then  
	   	  'Set value to zero in case it is smaller than zero  
	   	  var.tdipu001.suti  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.suti, 0, Items.Exception, DefaultFound)  	   
	  else  	   
	   	  var.tdipu001.suti  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.suti, Items.SupplyTime, Items.Exception, DefaultFound)  	   
	  end if  
	   
	  If Items.UnitforSupplyTime  =  "" then  
	   	  ' Set access value to 10 in case it is empty  
	   	  var.tdipu001.sutu  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sutu, 10, Items.Exception, DefaultFound, 10)  
	  Else  
	   	  var.tdipu001.sutu  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sutu, Items.UnitforSupplyTime, Items.Exception, DefaultFound, 10)  	   
	  End If  
	  var.tdipu001.sopr  =  set.source.of.price(Items.ItemType)  	  '  |  Fp9.n  
	  var.tdipu001.sopr  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sopr, var.tdipu001.sopr, Items.Exception, DefaultFound, 3)  
'  |   **********************************************************************************************   
'  |  Item default variables for Item Sales Data (tdisa001)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsSales.*   
	  from  	  ItemDefaultsSales  
	  where  	  ItemDefaultsSales.kitm  =  varint.itemtype And ItemDefaultsSales.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tdisa001.lmsp  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.lmsp, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.mnra  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.mnra, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.mmtl  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.mmtl, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.qidd  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qidd, 9999999.99, Items.Exception, DefaultFound)  
	  var.tdisa001.qimc  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qimc, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.qimo  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qimo, 1, Items.Exception, DefaultFound)  
	  var.tdisa001.umsp  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.umsp, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.cmgp  =  ItemHandling.GetTypeString(ItemDefaultsSales.cmgp, "", Items.Exception, DefaultFound)  
	  var.tdisa001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsSales.cwar, "", Items.Exception, DefaultFound)  
	  var.tdisa001.rbgp  =  ItemHandling.GetTypeString(ItemDefaultsSales.rbgp, "", Items.Exception, DefaultFound)  
	   
	  var.tdisa001.acci  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.acci, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.acom  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.acom, 0, Items.Exception, DefaultFound, 1)  
	  var.tdisa001.actn  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.actn, 0, Items.Exception, DefaultFound, 3)  
	  var.tdisa001.alod  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.alod, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.cphl  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.chpl, 0, Items.Exception, DefaultFound, 5)  	   
	  var.tdisa001.rcom  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.rcom, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.scon  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.scon, 0, Items.Exception, DefaultFound, 10)  
	  var.tdisa001.tltp  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.tltp, 0, Items.Exception, DefaultFound, 3)  
	  'Defaults presents and present in Item access table  
	  var.tdisa001.cpgs  =  ItemHandling.GetTypeString(ItemDefaultsSales.cpgs, Items.SalesPriceGroup, Items.Exception, DefaultFound)  
	  var.tdisa001.csgs  =  ItemHandling.GetTypeString(ItemDefaultsSales.csgs, Items.SalesStatisticsGroup, Items.Exception, DefaultFound)  
	  var.tdisa001.cups  =  ItemHandling.GetTypeString(ItemDefaultsSales.cups, Items.SalesPriceUnit, Items.Exception, DefaultFound)  
	  var.tdisa001.cuqs  =  ItemHandling.GetTypeString(ItemDefaultsSales.cuqs, Items.SalesUnit, Items.Exception, DefaultFound)  	   
	  var.tdisa001.cvat  =  ItemHandling.GetTypeString(ItemDefaultsSales.cvat, Items.TaxCodeSales, Items.Exception, DefaultFound)  
	  var.tdisa001.txts  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.txts, Items.TextIDSales, Items.Exception, DefaultFound)  
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tdisa001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.retw, 1, Items.Exception, DefaultFound, 2)  
	  else  
	   	  var.tdisa001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.retw, 2, Items.Exception, DefaultFound, 2)  
	  end if  
	   
'  |   **********************************************************************************************   	   
'  |   *  Setting variables for Item Sales Data (tdisa001)  
'  |   **********************************************************************************************   	   
	  if Items.SalesPrice  <  "0" Then  
	   	  ' minimum price is 0  
	   	  var.tdisa001.pris  =  0  
	  Else  
	   	  var.tdisa001.pris  =  Items.SalesPrice  
	  end if  
	   
	  if Items.SuggestedRetailPrice  <  "0" then  
	   	  ' minimum price is 0  
	   	  var.tdisa001.prir  =  0  
	  Else  
	   	  var.tdisa001.prir  =  Items.SuggestedRetailPrice  
	  end if  
	   
'  |   ********************************************************************************************   
'  |  It default variables for Item Ordering Data (tcibd200)  
'  |   ********************************************************************************************   
	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsOrdering.*   
	  from  	  ItemDefaultsOrdering  
	  where  	  ItemDefaultsOrdering.kitm  =  varint.itemtype And ItemDefaultsOrdering.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tcibd200.auso  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.auso, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.crmp  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.crmp, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.kctr  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.kctr, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.plpl  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.plpl, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tcibd200.ptyp  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.ptyp, 0, Items.Exception, DefaultFound, 3)  	   
	  var.tcibd200.uaoq  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.uaoq, 0, Items.Exception, DefaultFound, 2)  
	   
	  var.tcibd200.nopr  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.nopr, 1, Items.Exception, DefaultFound)  
	  var.tcibd200.ocst  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ocst, 0, Items.Exception, DefaultFound)  
	  var.tcibd200.serv  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.serv, 0, Items.Exception, DefaultFound)  
	  var.tcibd200.csps  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.csps, "", Items.Exception, DefaultFound)  
	  var.tcibd200.cspd  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cspd, "", Items.Exception, DefaultFound)  
	  var.tcibd200.cplb  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cplb, "", Items.Exception, DefaultFound)  
	  var.tcibd200.rgrp  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.rgrp, "", Items.Exception, DefaultFound)  
	  var.tcibd200.sfpl  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.sfpl, "", Items.Exception, DefaultFound)  
	  'Defaults presents and present in Item access table  
	  var.tcibd200.cwar  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cwar, Items.Warehouse, Items.Exception, DefaultFound)  	   
	  var.tcibd200.maxs  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maxs, Items.MaximumInventory, Items.Exception, DefaultFound)  	   
	  var.tcibd200.oint  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oint, Items.OrderInterval, Items.Exception, DefaultFound)  
	  var.tcibd200.reop  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.reop, Items.Reorderpoint, Items.Exception, DefaultFound)  
	  var.tcibd200.sftm  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.sftm, Items.SafetyTime, Items.Exception, DefaultFound)  
	  var.tcibd200.sfst  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.sfst, Items.SafetyStock, Items.Exception, DefaultFound)  
	  var.tcibd200.oivu  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.oivu, Items.OrderIntervalUnit, Items.Exception, DefaultFound, 10)  
	  var.tcibd200.omth  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.omth, Items.OrderMethod, Items.Exception, DefaultFound, 1)  
	  var.tcibd200.opol  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.opol, Items.OrderPolicy, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.tuni  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.tuni, Items.SafetyTimeUnit, Items.Exception, DefaultFound, 10)  
	   
	  If Items.OrderSystem  =  4 and Items.ItemType  <>  3 then  
	   	  var.tcibd200.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.osys, 9, Items.Exception, DefaultFound, 9)  
	  else  
	   	  var.tcibd200.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.osys, Items.OrderSystem, Items.Exception, DefaultFound, 9)  
	  end if  
	  if (Items.OrderQuantityIncrement  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.oqmf  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oqmf, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.oqmf  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oqmf, Items.OrderQuantityIncrement, Items.Exception, DefaultFound)  
	  end if  	   
	  if (Items.MinimumOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.mioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.mioq, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.mioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.mioq, Items.MinimumOrderQuantity, Items.Exception, DefaultFound)  
	  end if  
	  if (Items.MaximumOrderQuantity  <=  "0") then  
	   	  var.tcibd200.maoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maoq, 9999999, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tcibd200.maoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maoq, Items.MaximumOrderQuantity, Items.Exception, DefaultFound)  	   	   
	  End if  
	  If (Items.FixedOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.fioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.fioq, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.fioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.fioq, Items.FixedOrderQuantity , Items.Exception, DefaultFound)  	   	   
	  end if  
	   
	  If (Items.EconomicOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.ecoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ecoq, 1, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tcibd200.ecoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ecoq, Items.EconomicOrderQuantity, Items.Exception, DefaultFound)  
	  End if  
'  |   **********************************************************************************************   
'  |  Item default variables for Item Production Data (tiipd001)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsProduction.*   
	  from  	  ItemDefaultsProduction  
	  where  	  ItemDefaultsProduction.kitm  =  varint.itemtype And ItemDefaultsProduction.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tiipd001.pcrp  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.pcrp, 0, Items.Exception, DefaultFound)  
	  var.tiipd001.scdl  =  ItemHandling.GetTypeString(ItemDefaultsProduction.scdl, "", Items.Exception, DefaultFound)  
	  var.tiipd001.cick  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.cick, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.drin  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.drin, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.dris  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.dris, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.iuma  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.iuma, 0, Items.Exception, DefaultFound, 10)  
	  var.tiipd001.oqdr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oqdr, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.repi  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.repi, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.smfs  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.smfs, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tiipd001.swoc  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.swoc, 0, Items.Exception, DefaultFound, 1)  	   
	   
	  'Defaults presents and present in Item access table  
	  var.tiipd001.cpha  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.cpha, Items.Phantom, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.phst  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.phst, Items.UsePhantomInventory, Items.Exception, DefaultFound, 2)  
	  If Items.BackflushIfMaterial  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfcp  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfcp,2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfcp  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfcp,Items.BackflushIfMaterial, Items.Exception, DefaultFound, 2)  
	  End If  
	  If Items.BackflushMaterials  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfep  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfep,2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfep  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfep,Items.BackflushMaterials, Items.Exception, DefaultFound, 2)  
	  End If  
	  If Items.BackflushHours  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfhr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfhr, 2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfhr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfhr,Items.BackflushHours, Items.Exception, DefaultFound, 2)  
	  End if  
	   	   	   
	  If Items.RoutingQuantity  <=  "0" Then  
	   	  'Minimum value is 1  
	   	  var.tiipd001.runi  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.runi, 1, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.runi  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.runi, Items.RoutingQuantity, Items.Exception, DefaultFound)  	   
	  End if  
	  If Items.BOMQuantity  <=  "0" then  
	   	  'Minimum value is 1  
	   	  var.tiipd001.unom  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.unom, 1, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.tiipd001.unom  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.unom, Items.BOMQuantity, Items.Exception, DefaultFound)  	   	   
	  End if  
	  If Items.ScrapFactor  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.scpf  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpf, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.scpf  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpf, Items.ScrapFactor, Items.Exception, DefaultFound)  
	  End if  
	  If Items.ScrapQuantity  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.scpq  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpq, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.scpq  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpq, Items.ScrapQuantity, Items.Exception, DefaultFound)  
	  End if  
	  If Items.OrderLeadTimeUnit  =  0 Then  
	   	  'If not defined than it will be mapped with hours (5)  
	   	  var.tiipd001.oltu  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oltu, 5 , Items.Exception, DefaultFound, 5)  
	  Else  
	   	  var.tiipd001.oltu  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oltu,Items.OrderLeadTimeUnit, Items.Exception, DefaultFound, 5)  
	  End if  
	  If Items.OrderLeadTime  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.oltm  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.oltm, 0, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.tiipd001.oltm  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.oltm, Items.OrderLeadTime, Items.Exception, DefaultFound)  
	  End if  	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Planning Data (cprpd100)  
'  |   **********************************************************************************************   	   
	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	   	  ItemDefaultsPlanning.*   
	  from  	   	  ItemDefaultsPlanning  
	  where  	   	  ItemDefaultsPlanning.kitm  =  varint.itemtype And ItemDefaultsPlanning.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.cprpd100.fite  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.fite, "", Items.Exception, DefaultFound)  
	  var.cprpd100.fide  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.fide, "", Items.Exception, DefaultFound)  
	  var.cprpd100.mrpu  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.mrpu, "", Items.Exception, DefaultFound)  
	  var.cprpd100.rpun  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.rpun, "", Items.Exception, DefaultFound)  
	  '  
	  var.cprpd100.audf  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.audf, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.auiv  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.auiv, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.aupr  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.aupr, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.aupu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.aupu, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.catp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.catp, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.chat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.chat, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.coat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.coat, 0, Items.Exception, DefaultFound, 2)  	   
	  var.cprpd100.cria  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.cria, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.depd  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.depd, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.deps  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.deps, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.efpg  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.efpg, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.fatp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.fatp, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.fica  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.fica, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.info  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.info, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.mult  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.mult, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.onat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.onat, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.pbpl  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.pbpl, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.prio  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.prio, 0, Items.Exception, DefaultFound, 5)  
	  var.cprpd100.uatt  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.uatt, 0, Items.Exception, DefaultFound, 5)  
	  var.cprpd100.upho  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.upho, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.utmf  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.utmf, 0, Items.Exception, DefaultFound, 1)  
	  '  
	  var.cprpd100.atho  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.atho, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.atta  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.atta, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.attm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.attm, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.fasi  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fasi, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.fltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fltm, 9999, Items.Exception, DefaultFound)  
	  var.cprpd100.hoat  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.hoat, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.inho  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.inho, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.retf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.retf, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.tfat  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tfat, 0, Items.Exception, DefaultFound)  
	  '  
	  'Defaults presents and present in Item access table  
	  var.cprpd100.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.osys,Items.MaintainMasterPlan, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.plvl  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.plvl, Items.PlanLevel, Items.Exception, DefaultFound)  
	  var.cprpd100.plid  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.plid, Items.Planner, Items.Exception, DefaultFound)  
	  If Items.ExtraLeadTime  <  "0" then  
	   	  ' Mimimum value is 0  
	   	  var.cprpd100.eltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.eltm, 0, Items.Exception, DefaultFound)  
	  Else  	   
	   	  var.cprpd100.eltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.eltm, Items.ExtraLeadTime, Items.Exception, DefaultFound)  
	  End if  
	  If Items.ForecastTimeFence  <  "0" then  
	   	  ' Mimimum value is 0  
	   	  var.cprpd100.fctf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fctf, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.cprpd100.fctf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fctf, Items.ForecastTimeFence, Items.Exception, DefaultFound)  	   
	  End if  
	  If Items.TimeFence  <  "0" then  
	   	  ' Mimimum value is 0  
	   	  var.cprpd100.tmfc  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tmfc, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.cprpd100.tmfc  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tmfc, Items.TimeFence, Items.Exception, DefaultFound)  
	  End if  
	  If Items.UnitForExtraLeadTime  =  0 Then  
	   	  'If not defined than it will be mapped with days (10)  
	   	  var.cprpd100.eltu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.eltu,10, Items.Exception, DefaultFound, 10)  
	  Else  	   
	   	  var.cprpd100.eltu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.eltu,Items.UnitForExtraLeadTime, Items.Exception, DefaultFound, 10)  
	  End if  
	  If Items.TimeFenceUnit  =  0 then  
	   	  'If not defined than it will be mapped with days (10)  
	   	  var.cprpd100.tmfu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.tmfu,10, Items.Exception, DefaultFound, 10)  
	  Else  
	   	  var.cprpd100.tmfu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.tmfu,Items.TimeFenceUnit, Items.Exception, DefaultFound, 10)  
	  End if  
	  If Items.OrderHorizon  <=  "0" then  
	   	  If Items.MaintainMasterPlan  =  2 then  
	   	   	  'If Items.OrderHorizon is not specified it will be defaulted based upon MaintainMastesPlan.  
	   	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, 180, Items.Exception, DefaultFound)  
	   	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, 180, Items.Exception, DefaultFound)  
	   	  Else  
	   	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, 360, Items.Exception, DefaultFound)  
	   	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, 180, Items.Exception, DefaultFound)  
	   	  End if  	   	   	   
	  Else  
	   	  If Items.MaintainMasterPlan  =  2 then  
	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  
	   	  Else  
	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  *  2  
	   	  End If  
	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, Items.OrderHorizon, Items.Exception, DefaultFound)  	   	   
	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, var.cprpd100.ptmf, Items.Exception, DefaultFound)  
	  End if  
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Warehousing Data (whwmd400)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsWarehousing.*   
	  from  	  ItemDefaultsWarehousing  
	  where  	  ItemDefaultsWarehousing.kitm  =  varint.itemtype And ItemDefaultsWarehousing.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	   	   
	  'Defaults presents but not in Item access table  
	  var.whwmd400.cfmd  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.cfmd, "", Items.Exception, DefaultFound)  
	  var.whwmd400.pkdf  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.pkdf, "", Items.Exception, DefaultFound)  	   
	  var.whwmd400.rgtm  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.rgtm, "", Items.Exception, DefaultFound)  
	  var.whwmd400.risk  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.risk, "", Items.Exception, DefaultFound)  	   
	  var.whwmd400.ffsi  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.ffsi, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.npsl  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.npsl, 0, Items.Exception, DefaultFound)  	   
	  var.whwmd400.potc  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.potc, 0, Items.Exception, DefaultFound)  	   
	  var.whwmd400.qcma  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.qcma, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.qcmi  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.qcmi, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.txta, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.alle  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.alle, 0, Items.Exception, DefaultFound, 1)  
	  var.whwmd400.askp  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.askp, 0, Items.Exception, DefaultFound, 1)  	   
	  var.whwmd400.assi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.assi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ccma  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ccma, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.coas  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.coas, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.cspr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.cspr, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ctzi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ctzi, 0, Items.Exception, DefaultFound, 5)  	   
	  var.whwmd400.dmsi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmsp  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsp, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmsr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsr, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmss  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmss, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dwhs  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dwhs, 0, Items.Exception, DefaultFound, 70)  	   
	  var.whwmd400.dycd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dycd, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.excc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.excc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.hama  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.hama, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.kpsl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.kpsl, 0, Items.Exception, DefaultFound, 4)  	   
	  var.whwmd400.lveh  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lveh, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.mabc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.mabc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.niwo  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.niwo, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.owip  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owip, 0, Items.Exception, DefaultFound, 20)  	   
	  var.whwmd400.owrl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owrl, 0, Items.Exception, DefaultFound, 10)  	   
	  var.whwmd400.owrt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owrt, 0, Items.Exception, DefaultFound, 10)  	   
	  var.whwmd400.prva  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.prva, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.spri  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.spri, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.thus  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.thus, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ufpl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ufpl, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.uhnd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.uhnd, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.vers  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.vers, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.wmsc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.wmsc, 0, Items.Exception, DefaultFound, 2)  	   
	   
	  'Defaults presents and present in Item access table  
	  var.whwmd400.usab  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.usab, Items.ExpectedAnnualIssue, Items.Exception, DefaultFound)  
	  var.whwmd400.ivgr  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.ivgr, Items.ItemValuationGroup, Items.Exception, DefaultFound)  
	   
	  var.whwmd400.abcc  =  Ucase(Left(Items.Abcc, 1))  
	  var.whwmd400.abcc  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.abcc, var.whwmd400.abcc, Items.Exception, DefaultFound)  
	  if Items.FloorStock  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.pics  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.pics, 2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.whwmd400.pics  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.pics, Items.FloorStock, Items.Exception, DefaultFound, 2)  
	  end if  
	  if Items.InventoryCarryingCosts  <  "0" Then  
	   	  ' Mimimum value is 0  
	   	  var.whwmd400.scst  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.scst, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.whwmd400.scst  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.scst, Items.InventoryCarryingCosts, Items.Exception, DefaultFound)  	   	   	   	   
	  End if  
	   
	  if Items.Height  <  "0" Then  
	   	  ' Mimimum value is 0  
	   	  var.whwmd400.hght  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.hght, 0, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.whwmd400.hght  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.hght, Items.Height, Items.Exception, DefaultFound)  
	  end if  
	  if Items.Width  <  "0" Then  
	   	  ' Mimimum value is 0  
	   	  var.whwmd400.wdth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.wdth, 0, Items.Exception, DefaultFound)  	   
	  Else  
	   	  var.whwmd400.wdth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.wdth, Items.Width, Items.Exception, DefaultFound)  
	  end if  
	  if Items.Depth  <  "0" then  
	   	  ' Mimimum value is 0  
	   	  var.whwmd400.dpth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.dpth, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.whwmd400.dpth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.dpth, Items.Depth, Items.Exception, DefaultFound)  	   	   
	  end if  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case of Outbound Method  
'  |   **********************************************************************************************   
	  if Items.OutboundMethod  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.obpr  =  2 ' FIFO  
	  end if  
	   
	  If Items.ItemType  =  4 Then  
	   	  'Set default values in case of cost items  
	   	  var.whwmd400.obpr  =  3 ' By Location  
	  end if  
	  var.whwmd400.obpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.obpr, var.whwmd400.obpr, Items.Exception, DefaultFound, 3)  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case of Location Controlled  
'  |   **********************************************************************************************   	   
	  if Items.LocationControlled  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.locc  =  1 ' Yes  
	  Else  
	   	  var.whwmd400.locc  =  Items.LocationControlled  
	  End if  
	  If Items.ItemType  =  4 Then  
	   	  'Set default values in case of cost items  
	   	  var.whwmd400.locc  =  2 ' No  
	  End if  	   
	  var.whwmd400.locc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.locc, var.whwmd400.locc, Items.Exception, DefaultFound, 1)  
'  |   **********************************************************************************************   	   	   
'  |  In case of Lot Controlled  
'  |   **********************************************************************************************   	   
	  If Items.LotPrice  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.ltpr  =  2 ' No  
	  Else  
	   	  var.whwmd400.ltpr  =  Items.LotPrice  	   
	  End if  
	  if Items.LotControlled  =  1 then  
	   	  if Items.LotsInInventory  =  1 then  
	   	   	  'Lot controlled and in inventory  
	   	   	  var.whwmd400.lttr  =  1 'Yes  
	   	   	  var.whwmd400.linv  =  1 'Yes  
	   	   	  var.whwmd400.ledd  =  3 'Not applicable  
	   	   	  var.whwmd400.ledr  =  3 'Not applicable  
	   	   	  var.whwmd400.ledt  =  3 'Not applicable  
	   	   	  var.whwmd400.lisf  =  3 'Not applicable  
	   	   	  var.whwmd400.lism  =  3 'Not applicable  
	   	  else  
	   	   	  'Lot controlled not in inventory  
	   	   	  var.whwmd400.lttr  =  1 'Yes  
	   	   	  var.whwmd400.linv  =  2 'No  
	   	   	  var.whwmd400.ledd  =  1 'Yes  
	   	   	  var.whwmd400.ledr  =  2 'No  
	   	   	  var.whwmd400.ledt  =  2 'No  
	   	   	  var.whwmd400.lisf  =  2 'No  
	   	   	  var.whwmd400.lism  =  2 'No  
	   	  end if  
	   	   
	  else  
	   	  'Not lot controlled  
	   	  var.whwmd400.ltpr  =  2 'No  
	   	  var.whwmd400.lttr  =  2 'No  
	   	  var.whwmd400.linv  =  2 'No  
	   	  var.whwmd400.ledd  =  3 'Not applicable  
	   	  var.whwmd400.ledr  =  3 'Not applicable  
	   	  var.whwmd400.ledt  =  3 'Not applicable  
	   	  var.whwmd400.lisf  =  3 'Not applicable  
	   	  var.whwmd400.lism  =  3 'Not applicable  
	  end if  
	   
	  var.whwmd400.ltpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ltpr, var.whwmd400.ltpr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.lttr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lttr, var.whwmd400.lttr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.linv  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.linv, var.whwmd400.linv, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.ledd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledd, var.whwmd400.ledd, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.ledr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledr, var.whwmd400.ledr, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.ledt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledt, var.whwmd400.ledt, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.lisf  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lisf, var.whwmd400.lisf, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.lism  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lism, var.whwmd400.lism, Items.Exception, DefaultFound, 3)  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case Serialized  
'  |   **********************************************************************************************   	   
	  If Items.SerialPrice  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.srpr  =  2 ' No  
	  Else  
	   	  var.whwmd400.srpr  =  Items.SerialPrice  	   
	  End if  
	  if Items.Serialized  =  1 then  
	   	  if Items.SerialsInInventory  =  1 then  
	   	   	  'Serialized and in inventory  
	   	   	  var.whwmd400.srtr  =  1 'Yes  
	   	   	  var.whwmd400.sinv  =  1 'Yes  
	   	   	  var.whwmd400.sedd  =  3 'Not applicable  
	   	   	  var.whwmd400.sedr  =  3 'Not applicable  
	   	   	  var.whwmd400.sedt  =  3 'Not applicable  
	   	   	  var.whwmd400.sisf  =  3 'Not applicable  
	   	   	  var.whwmd400.sism  =  3 'Not applicable  
	   	  else  
	   	   	  'Serialized not in inventory  
	   	   	  var.whwmd400.srtr  =  1 'Yes  
	   	   	  var.whwmd400.sinv  =  2 'No  
	   	   	  var.whwmd400.sedd  =  1 'Yes  
	   	   	  var.whwmd400.sedr  =  2 'No  
	   	   	  var.whwmd400.sedt  =  2 'No  
	   	   	  var.whwmd400.sisf  =  2 'No  
	   	   	  var.whwmd400.sism  =  2 'No  
	   	  end if  
	  else  
	   	  ' Not serialized  
	   	  var.whwmd400.srpr  =  2 'No  
	   	  var.whwmd400.srtr  =  2 'No  
	   	  var.whwmd400.sinv  =  2 'No  
	   	  var.whwmd400.sedd  =  3 'Not applicable  
	   	  var.whwmd400.sedr  =  3 'Not applicable  
	   	  var.whwmd400.sedt  =  3 'Not applicable  
	   	  var.whwmd400.sisf  =  3 'Not applicable  
	   	  var.whwmd400.sism  =  3 'Not applicable  
	  end if  
	   
	  var.whwmd400.srpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.srpr, var.whwmd400.srpr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.srtr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.srtr, var.whwmd400.srtr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.sinv  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sinv, var.whwmd400.sinv, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.sedd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedd, var.whwmd400.sedd, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sedr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedr, var.whwmd400.sedr, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sedt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedt, var.whwmd400.sedt, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sisf  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sisf, var.whwmd400.sisf, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sism  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sism, var.whwmd400.sism, Items.Exception, DefaultFound, 3)  
	   	   	   	   	   	   	   	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item service Data (tsmdm200)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsService.*   
	  from  	  ItemDefaultsService  
	  where  	  ItemDefaultsService.kitm  =  varint.itemtype And ItemDefaultsService.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	   
	  'Defaults presents but not in Item access table  	   
	  var.tsmdm200.acos  =  ItemHandling.GetTypeEnum(ItemDefaultsService.acos, 0, Items.Exception, DefaultFound, 70)  
	  var.tsmdm200.cmtc  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cmtc, 0, Items.Exception, DefaultFound, 20)  
	  var.tsmdm200.cmts  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cmts, 0, Items.Exception, DefaultFound, 20)  
	  var.tsmdm200.cvco  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cvco, 0, Items.Exception, DefaultFound, 15)  	   
	  var.tsmdm200.dltp  =  ItemHandling.GetTypeEnum(ItemDefaultsService.dltp, 0, Items.Exception, DefaultFound, 4)  
	  var.tsmdm200.dtps  =  ItemHandling.GetTypeEnum(ItemDefaultsService.dtps, 0, Items.Exception, DefaultFound, 10)  
	  var.tsmdm200.rmcr  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rmcr, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rmsr  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rmsr, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rncw  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rncw, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rpyn  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rpyn, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rwun  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rwun, 0, Items.Exception, DefaultFound, 5)  
	  var.tsmdm200.sirq  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sirq, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.sswt  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sswt, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.uval  =  ItemHandling.GetTypeEnum(ItemDefaultsService.uval, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.blag  =  ItemHandling.GetTypeString(ItemDefaultsService.blag, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ccds  =  ItemHandling.GetTypeString(ItemDefaultsService.ccds, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ccme  =  ItemHandling.GetTypeString(ItemDefaultsService.ccme, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ckgr  =  ItemHandling.GetTypeString(ItemDefaultsService.ckgr, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cmea  =  ItemHandling.GetTypeString(ItemDefaultsService.cmea, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cmpo  =  ItemHandling.GetTypeString(ItemDefaultsService.cmpo, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cogr  =  ItemHandling.GetTypeString(ItemDefaultsService.cogr, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cwte  =  ItemHandling.GetTypeString(ItemDefaultsService.cwte, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.gwte  =  ItemHandling.GetTypeString(ItemDefaultsService.gwte, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.peru  =  ItemHandling.GetTypeString(ItemDefaultsService.peru, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.prun  =  ItemHandling.GetTypeString(ItemDefaultsService.prun, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.sbct  =  ItemHandling.GetTypeString(ItemDefaultsService.sbct, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.swte  =  ItemHandling.GetTypeString(ItemDefaultsService.swte, "", Items.Exception, DefaultFound)  
	   
	  var.tsmdm200.mepo  =  ItemHandling.GetTypeNumber(ItemDefaultsService.mepo, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.nrpe  =  ItemHandling.GetTypeNumber(ItemDefaultsService.nrpe, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.rwdu  =  ItemHandling.GetTypeNumber(ItemDefaultsService.rwdu, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.srpd  =  ItemHandling.GetTypeNumber(ItemDefaultsService.srpd, 0, Items.Exception, DefaultFound)  
	   
	  'Defaults presents and present in Item access table  
	  var.tsmdm200.ccur  =  ItemHandling.GetTypeString(ItemDefaultsService.ccur, Items.ServiceCurrency, Items.Exception, DefaultFound)  
	  var.tsmdm200.cups  =  ItemHandling.GetTypeString(ItemDefaultsService.cups, Items.SalesUnit, Items.Exception, DefaultFound)  
	  var.tsmdm200.cuqs  =  ItemHandling.GetTypeString(ItemDefaultsService.cuqs, Items.SalesUnit, Items.Exception, DefaultFound)  
	  var.tsmdm200.cwoc  =  ItemHandling.GetTypeString(ItemDefaultsService.cwoc, Items.ServiceDepartment, Items.Exception, DefaultFound)  
	  var.tsmdm200.sigr  =  ItemHandling.GetTypeString(ItemDefaultsService.sigr, Items.SerializedItemGroup, Items.Exception, DefaultFound)  
	  var.tsmdm200.pris  =  ItemHandling.GetTypeNumber(ItemDefaultsService.pris, Items.ServicePrice, Items.Exception, DefaultFound)  
	   
'  |   **********************************************************************************************   	   	   
'  |   *  Setting variables for Item Service Data (tsmdm200)  
'  |   **********************************************************************************************   	   
	  If Items.ConfigurationControlled  <>  1 then  
	   	  var.tsmdm200.csgr  =  ItemHandling.GetTypeString(ItemDefaultsService.csgr, "", Items.Exception, DefaultFound)  
	  Else  
	   	  var.tsmdm200.csgr  =  ItemHandling.GetTypeString(ItemDefaultsService.csgr, Items.ServiceItemGroup, Items.Exception, DefaultFound)  
	  End if  
	   
	  If Items.ConfigurationControlled  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tsmdm200.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsService.seri, 0, Items.Exception, DefaultFound, 3)  	   
	  Else  
	   	  var.tsmdm200.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsService.seri, Items.ConfigurationControlled, Items.Exception, DefaultFound, 3)  	   
	  End If  
	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Project Data (tppdm005)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsProject.*   
	  from  	  ItemDefaultsProject  
	  where  	  ItemDefaultsProject.kitm  =  varint.itemtype And ItemDefaultsProject.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	   
	  'Defaults presents but not in Item access table  
	  var.tppdm005.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsProject.txta, 0, Items.Exception, DefaultFound)  
	  'Defaults presents and present in Item access table  	   
	  var.tppdm005.ccur  =  ItemHandling.GetTypeString(ItemDefaultsProject.ccur, Items.CostPriceCurrency, Items.Exception, DefaultFound)  
	   
	  If Items.ControlFunction  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.ccfu  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.ccfu, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.ccfu  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.ccfu, Items.ControlFunction, Items.Exception, DefaultFound, 1)  
	  End If  	   
	   	   
	  If Items.ProjectOrderSystem  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, 0, Items.Exception, DefaultFound, 9)  
	  Else  	   
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, Items.ProjectOrderSystem, Items.Exception, DefaultFound, 9)  
	  End If  
	   
	  If Item.PricePolicy  =  0 Then  
	   	  'Use default value if not specified  	   
	   	  var.tppdm005.cppp  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.cppp, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.cppp  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.cppp, Item.PricePolicy, Items.Exception, DefaultFound, 1)  
	  End if  	   	   
	   
	  If Items.ProjectOrderSystem  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, 0, Items.Exception, DefaultFound, 9)  
	  Else  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, Items.ProjectOrderSystem, Items.Exception, DefaultFound, 9)  
	  End if  	   
	   	   
	  If Items.RegisterProgress  =  0 Then  
	   	  'Use default value if not specified  	   
	   	  var.tppdm005.prre  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.prre, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.prre  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.prre, Items.RegisterProgress, Items.Exception, DefaultFound, 1)  	   
	  End If  
	   
	  var.tppdm005.ccit  =  get.segment.item.code(Items.CCItemProjectSegment, Items.CCItemItemSegment)  
	  var.tppdm005.ccit  =  ItemHandling.GetTypeString(ItemDefaultsProject.ccit, var.tppdm005.ccit, Items.Exception, DefaultFound)  	   
	   
	   
'  |   **********************************************************************************************   	   
'  |   *  Actual Dump Section  
'  |   **********************************************************************************************   	   
	  dump 001 '  |   *  Dump for tcibd001  
	  dump 400 '  |   *  Dump for whwmd400  
	   
	  if Items.ItemPurchaseData  <>  2 then  
	   	  dump 002 '  |   *  Dump for tdipu001  
	   	  dump 102 '  |   *  Dump for tdipu100  
	  end if  
	   
	  if Items.ItemSalesData  <>  2 then  
	   	  dump 003 '  |   *  Dump for tdisa001  
	  end if  
	   
	  if Items.ItemProductionData  <>  2 and _  
	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5) then  
	   	  dump 004 '  |   *  Dump for tiipd001  
	  end if  
	   
	  if Items.ItemType  <>  6 and Items.ItemType  <>  10 then  
	   	  dump 007 '  |   *  Dump for ticpr007  
	  end if  
	   
	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  10) then  
	   	  dump 100 '  |   *  Dump for tcibd100  
	  end if  
	   
	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5 or Items.ItemType  =  10) then  
	   	  cluster.found  =  0  
	   	  If varstr.cprj  =  "" or IsNUll(varstr.cprj) then  
	   	   	  select  	  ItemsByCluster.*   
	   	   	  from  	  ItemsByCluster  
	   	   	  where  	  (ItemsByCluster.Project  =  "" and ItemsByCluster.Item  =  varstr.item)  
	   	   	  selectdo  
	   	   	   	  cluster.found  =  1  
	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	   
	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	   
	   	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	   	  ' dump 120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
	   	   	  endselect  
	   	  Else  
	   	   	  select  	  ItemsByCluster.*   
	   	   	  from  	  ItemsByCluster  
	   	   	  where  	  (ItemsByCluster.Project  =  varstr.cprj and ItemsByCluster.Item  =  varstr.item)  
	   	   	  selectdo  
	   	   	   	  cluster.found  =  1  
	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	   
	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	   
	   	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	   	  'dump 120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
	   	   	  endselect  
	   	  End If  	   	   
	   	  if cluster.found  =  0 then  
	   	   	  varstr.clus  =  "   "  	   	   
	   	   	  var.planned.item  =  get.segment.cp.item.code(varstr.clus,varstr.cprj,varstr.item)  
	   	   	  var.cprpd100.cwar  =  Items.Warehouse  	   	   	   
	   	   	  var.cprpd100.sour  =  1  	   	   	   	   	   
	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	  ' dump 120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
	   	  end if  
	   	  dump 200 '  |   *  Dump for tcibd200  
	  end if  
	   
	  if Items.ItemServiceData  <>  2 and _  
	   	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  
	   	   	  dump 201 '  |   *  Dump for tsmdm200  
	  end if  
	  if Items.ItemProjectData  <>  2 then  
	   	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  	   
	   	   	  dump 005 '  |   *  Dump for tppdm005  
	   	  end if  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:S
:QURY:START
select  	   	  Items.*
from 	   	  Items
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:X
:QURY:START
'  |   **********************************************************************************************   	   
'  |  Restructured the script for the implementation of the item defaulting.  
'  |   	   
'  |  Cleaned Source for the below solutions and marking related to previous FP version  <  9  
'  |   -  243214  
'  |   -  244255  
'  |   -  244268  
'  |   -  244355  
'  |   -  249608  
'  |   **********************************************************************************************
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:D
:QURY:START
	  dump 64 '  |  PE to tcibd001  
	  dump 65 '  |  PE to tdipu001  
	  dump 66 '  |  PE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:S
:QURY:START
select ProjectEquipments.*
from ProjectEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:D
:QURY:START
	  if ProjectSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuti  
	  end if  
	  dump 74 '  |   *  PS to tcibd001  
	  dump 75 '  |   *  PS to tdipu001  
	  dump 76 '  |   *  PS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:S
:QURY:START
select ProjectSubcontractings.*
from ProjectSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:D
:QURY:START
	  if StandardEquipments.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 61 '  |   *  SE to tcibd001  
	  dump 62 '  |   *  SE to tdipu001  
	  dump 63 '  |   *  SE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:S
:QURY:START
select StandardEquipments.*
from StandardEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:D
:QURY:START
	  if StandardSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuti  
	  end if  
	  if StandardSubcontractings.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 71 '  |   *  SS to tcibd001  
	  dump 72 '  |   *  SS to tdipu001  
	  dump 73 '  |   *  SS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:S
:QURY:START
select StandardSubcontractings.*
from StandardSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AlternativeItems
:ICOD:D
:QURY:START
	  var.str.sdte  =  get.utc(AlternativeItems.IntroductionDate,"yes")  
	  var.str.edte  =  get.utc(AlternativeItems.ExpiryDate,"no")  
dump 005
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AlternativeItems
:ICOD:S
:QURY:START
select AlternativeItems.*
from AlternativeItems
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tc
:TCMOD:ibd
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AlternativeItems
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:D
:QURY:START
	  var.tdipu010.scrp  =  ItemPurchaseBP.SourcingPercentage  
	  if (var.tdipu010.scrp  =  "0") then  
	   	  var.tdipu010.scrp  =  100  
	  end if  
	   
	  var.tdipu010.efdt  =  get.utc(ItemPurchaseBP.EffectiveDate,"yes")  
	  'var.tdipu010.exdt  =  get.utc(ItemPurchaseBP.ExpDate,"yes")  
	  If ItemPurchaseBP.ExpDate  =  "" or IsNull(ItemPurchaseBP.ExpDate) then  	   
	   	  var.tdipu010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tdipu010.exdt  =  get.utc(ItemPurchaseBP.ExpDate,"yes")  
	  end if  
	  varstr.cprj  =  ItemPurchaseBP.Project  
	  varstr.item  =  ItemPurchaseBP.Item  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select  	  Items.*   
	   	  from  	   	  Items  
	   	  where  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  else  
	   	  select Items.*   
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj AND Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  end if  
	  dump 010  	  '  |   #  tdipu010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:S
:QURY:START
select ItemPurchaseBP.*
from ItemPurchaseBP
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:D
:QURY:START
	  var.tdisa010.efdt  =  get.utc(ItemSalesBP.EffectiveDate,"yes")  
	  'var.tdisa010.exdt  =  get.utc(ItemSalesBP.ExpDate,"yes")  	   
	  If ItemSalesBP.ExpDate  =  "" or IsNull(ItemSalesBP.ExpDate) then  	   
	   	  var.tdisa010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tdisa010.exdt  =  get.utc(ItemSalesBP.ExpDate,"yes")  
	  end if  
dump 010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:S
:QURY:START
select ItemSalesBP.*
from ItemSalesBP
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixDefinitions
:ICOD:D
:QURY:START
	   
	  Matrix.Level.found  =  tdpcg010.get.matrix.sequences(MatrixDefinitions.MatrixType, MatrixDefinitions.MatrixDefinition, var.tdpcg010.malv, var.tdpcg010.mapr)  
	  if not Matrix.Level.found then  
	   	  'Sequences for matrix definition not found then Fill variables with default values.  	   
	   	  var.tdpcg010.malv  =  6 'Not applicable  
	   	  var.tdpcg010.mapr  =  0  	   
	  end if  
	  dump 010  	  'tdpcg010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixDefinitions
:ICOD:S
:QURY:START
select  	  MatrixDefinitions.*
from 	  MatrixDefinitions
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixDefinitions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:012
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DiscountScheduleCodes
:ICOD:D
:QURY:START
	  dump 012 ' |  # tdpcg012
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:012
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DiscountScheduleCodes
:ICOD:S
:QURY:START
select DiscountScheduleCodes.*
from DiscountScheduleCodes  	
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:012
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DiscountScheduleCodes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixSequences
:ICOD:D
:QURY:START
	  var.tdpcg020.efdt  =  get.utc(MatrixSequences.EffectiveDate,"yes")  
	  var.tdpcg020.exdt  =  get.utc(MatrixSequences.ExpiryDate,"no")  
	  dump 010 '  |  tdpcg020
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixSequences
:ICOD:S
:QURY:START
select MatrixSequences.*
from MatrixSequences
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MatrixSequences
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:021
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DiscountSchedules
:ICOD:D
:QURY:START
	  var.tdpcg021.efdt  =  get.utc(DiscountSchedules.EffectiveDate,"yes")  
	  var.tdpcg021.exdt  =  get.utc(DiscountSchedules.ExpiryDate,"no")  
	  dump 021 '  |  tdpcg021
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:021
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DiscountSchedules
:ICOD:S
:QURY:START
select  	  DiscountSchedules.*
from 	  DiscountSchedules
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:021
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DiscountSchedules
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:D
:QURY:START
	  var.tdpcg030.efdt  =  get.utc(Matrices.EffectiveDate,"yes")  
	   
	   
	  dump 030 '  |  tdpcg030
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:S
:QURY:START
select Matrices.*
from Matrices
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:D
:QURY:START
	  var.tdpcg031.efdt  =  get.utc(PriceBooks.EffectiveDate,"yes")  
	  var.tdpcg031.exdt  =  get.utc(PriceBooks.ExpiryDate,"no")  	   
	  var.tdpcg031.endt  =  get.utc(PriceBooks.EntryDate,"yes")  	   
	   
	  dump 031 '  |  tdpcg031
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:S
:QURY:START
select PriceBooks.*
from PriceBooks
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:fam
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Assets
:ICOD:D
:QURY:START
	  if Assets.AssetDistrBy  =  "0" then  
	   	  var.dbfg  =  1  
	  else  
	   	  var.dbfg  =  Assets.AssetDistrBy  
	  end if  
	  if Assets.Listed  =  "0" then  
	   	  var.list  =  2  
	  else  
	   	  var.list  =  Assets.Listed  
	  end if  
	  if Assets.New  =  "0" then  
	   	  var.newu  =  1  
	  else  
	   	  var.newu  =  Assets.New  
	  end if  
	  if Assets.Owner  =  "0" then  
	   	  var.ownc  =  1  
	  else  
	   	  var.ownc  =  Assets.Owner  
	  end if  
	  if len(trim(Assets.Description))  >  0 then  
	   	  varstr.dsca  =  Assets.Description  	   	   
	  else  
	   	  varstr.dsca  =  Assets.AssetNumber  &  ", "  &  Assets.AssetExtension  
	  end if  
	   
	  var.tffam100.ratd  =  get.utc(Assets.RateDate,"yes")  
	  var.tffam100.acmd  =  get.date(Assets.LastMaintDate,"no")  
	  var.tffam100.pudt  =  get.date(Assets.PurchaseDate,"yes")  
	  var.tffam100.srvc  =  get.date(Assets.ServiceDate,"yes")  
	  dump 100 '  |  tffam100
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:fam
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Assets
:ICOD:S
:QURY:START
select Assets.*
from Assets
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:fam
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Assets
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:fam
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssetBook
:ICOD:D
:QURY:START
	  if AssetBook.DeprBelowSalvage  =  0 then  
	   	  var.bslv  =  2  
	  else  
	   	  var.bslv  =  AssetBook.DeprBelowSalvage  
	  end if  
	  if AssetBook.EconomicRecapture  =  0 then  
	   	  var.ecre  =  2  
	  else  
	   	  var.ecre  =  AssetBook.EconomicRecapture  
	  end if  
	   
	  var.tffam110.curd  =  get.date(AssetBook.RecoveryDate,"no")  
	  var.tffam110.disd  =  get.date(AssetBook.FinalDisposalDate,"no")  
	  var.tffam110.last  =  get.date(AssetBook.LastDeprDate,"no")  
	   	   
	  dump 110 '  |  tffam110
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:fam
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssetBook
:ICOD:S
:QURY:START
select AssetBook.*
from AssetBook
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:fam
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssetBook
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:gld
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Periods
:ICOD:D
:QURY:START
	  dump 1
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:gld
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Periods
:ICOD:S
:QURY:START
select Periods.*
from Periods
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:gld
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Periods
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:gld
:TFLNO:006
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:D
:QURY:START
	  var.tfgld006.ydsc  =  EndDatesByYear.ydsc  	   
	  '  |  Description is mandatory  
	  if EndDatesByYear.ydsc  =  empty then  
	   	  var.tfgld006.ydsc  =  EndDatesByYear.year  
	  end if  
	  dump 1
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:gld
:TFLNO:006
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:S
:QURY:START
select EndDatesByYear.*
from EndDatesByYear
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:gld
:TFLNO:006
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EndDatesByYear
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:gld
:TFLNO:017
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypeSeries
:ICOD:D
:QURY:START
	  dump 017
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:gld
:TFLNO:017
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypeSeries
:ICOD:S
:QURY:START
select  	  TransactionTypeSeries.*
from 	  TransactionTypeSeries
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tf
:TCMOD:gld
:TFLNO:017
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypeSeries
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:D
:QURY:START
	  var.tibom010.indt  =  get.utc(BillOfMaterial.EffectiveDate,"yes")  
	  'var.tibom010.exdt  =  get.utc(BillOfMaterial.ExpiryDate,"no")  	   	   
	  If BillOfMaterial.ExpiryDate  =  "" or IsNull(BillOfMaterial.ExpiryDate) then  	   
	   	  var.tibom010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tibom010.exdt  =  get.utc(BillOfMaterial.ExpiryDate,"no")  
	  end if  
	  dump 010 '  |  tibom010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:S
:QURY:START
select BillOfMaterial.*
from BillOfMaterial
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:D
:QURY:START
	  if Projects.btco  =  1 then  
	   	  var.tppdm600.cmog  =  2  
	  else  
	   	  var.tppdm600.cmog  =  3  
	  end if  
	  if Projects.intp  =  1 then  
	   	  var.tppdm600.ipin  =  2  
	  else  
	   	  var.tppdm600.ipin  =  1  
	  end if  
	  var.tppdm600.rate  =  Projects.rate  
	  if trim(var.tppdm600.rate)  =  "" or IsNull(var.tppdm600.rate) then  
	   	  var.tppdm600.rate  =  1  
	  end if  
	  var.tppdm600.guid  =  "MIG_tppdm600_"  &  Projects.cprj  	   
	  dump 600 '  |   *  tppdm600  
	  dump 113 '  |   *  tcemm113  
	  dump 610 '  |   *  tcemm110 for tp
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:S
:QURY:START
select Projects.*
from Projects
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:D
:QURY:START
	  varstr.address  =  WorkCenter.Address  
	  select Addresses.City  
	  from  	  Addresses  
	  where Addresses.AddressCode  =  varstr.address  
	  selectdo  
	  endselect  
	   
	  var.tcmcs065.city  =  Left(Addresses.City, 8)  
	  dump 001 '  |   *  tirou001  
	  dump 065 '  |   *  tcmcs065  
	  dump 110 '  |   *  tcemm110  
	  dump 124 '  |   *  tcemm124  
	  dump 200 '  |   *  cprpd200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:S
:QURY:START
select WorkCenter.*
from WorkCenter
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:rou
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingCodesByItem
:ICOD:D
:QURY:START
	  if RoutingCodesByItem.RoutingQuantity  =  "0" then  
	   	  var.tirou101.runi  =  "1"  
	  else  
	   	  var.tirou101.runi  =  RoutingCodesByItem.RoutingQuantity  
	  end if  
	   	   
dump 101
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:rou
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingCodesByItem
:ICOD:S
:QURY:START
select RoutingCodesByItem.*
from RoutingCodesByItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:rou
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingCodesByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:D
:QURY:START
'  |   *  ERP  -  00000  -  51389.sn  
	  var.cycletime  =  RoutingOperation.CycleTime  
	  varstr.cprj  =  RoutingOperation.ManufacturedProject  
	  varstr.item  =  RoutingOperation.ManufacturedItem  
	  varstr.routing  =  RoutingOperation.Routing  
	  var.quantity  =  0  
'  |   *  ERP  -  00000  -  51389.en  
	  If varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select RoutingCodesByItem.RoutingQuantity  
	   	  from  	  RoutingCodesByItem  
	   	  where RoutingCodesByItem.ManufacturedItem  =  varstr.item  
	   	  and  	  RoutingCodesByItem.Routing  =  varstr.routing  
	   	  selectdo  
	   	   	  If RoutingCodesByItem.ManufacturedProject  =  "" or IsNull(RoutingCodesByItem.ManufacturedProject) then  
	   	   	   	  var.quantity  =  RoutingCodesByItem.RoutingQuantity  
	   	   	  End If  
	   	  endselect  
	  else  
	   	  select RoutingCodesByItem.RoutingQuantity  
	   	  from  	  RoutingCodesByItem  
	   	  where RoutingCodesByItem.ManufacturedProject  =  varstr.cprj  
	   	  and  	  RoutingCodesByItem.ManufacturedItem  =  varstr.item  
	   	  and  	  RoutingCodesByItem.Routing  =  varstr.routing  
	   	  selectdo  
	   	   	  var.quantity  =  RoutingCodesByItem.RoutingQuantity  
	   	  endselect  
	  End If  
'  |   *  ERP  -  00000  -  51389.sn  
	  if var.cycletime  >  "0" then  
	   	  if var.quantity  =  "0" then  
'  |  243218.o  	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime) ,2)  
	   	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime) ,2,0,0,0) '  |  243218.n  
	   	  else  
'  |  243218.o  	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime)  *  Cdbl(var.quantity) ,2)  
	   	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime)  *  Cdbl(var.quantity) ,2,0,0,0) '  |  243218.n  
	   	  end if  
	  else  
	   	  var.tirou102.prte  =  0  
	  end if  
'  |   *  ERP  -  00000  -  51389.en  
	  var.tirou102.indt  =  get.utc(RoutingOperation.EffectiveDate,"yes")  
	  If RoutingOperation.ExpiryDate  =  "" or IsNull(RoutingOperation.ExpiryDate)then  	   
	   	  var.tirou102.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tirou102.exdt  =  get.utc(RoutingOperation.ExpiryDate,"yes")  
	  end if  	   
	  dump 102 '  |  tirou102
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:S
:QURY:START
select RoutingOperation.*
from RoutingOperation
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:015
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardLabors
:ICOD:D
:QURY:START
	  if CDbl(StandardLabors.ratc)  >  0 then  
	   	  var.tppdm015.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm015.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardLabors.rats)  >  0 then  
	   	  var.tppdm015.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm015.ltrs  =  get.utc("","no")  
	  end if  
	  dump 01 '  |   #  tppdm015
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:015
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardLabors
:ICOD:S
:QURY:START
select StandardLabors.*
from StandardLabors
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:015
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardLabors
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:D
:QURY:START
	  if CDbl(StandardEquipments.ratc)  >  0 then  
	   	  var.tppdm025.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardEquipments.rats)  >  0 then  
	   	  var.tppdm025.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrs  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardEquipments.ratp)  >  0 then  
	   	  var.tppdm025.ltrp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:S
:QURY:START
select StandardEquipments.*
from StandardEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:D
:QURY:START
	  if CDbl(StandardSubcontractings.pric)  >  0 then  
	   	  var.tppdm035.ltpc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltpc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSubcontractings.pris)  >  0 then  
	   	  var.tppdm035.ltps  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltps  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSubcontractings.prip)  >  0 then  
	   	  var.tppdm035.ltpp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltpp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:S
:QURY:START
select StandardSubcontractings.*
from StandardSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSundryCosts
:ICOD:D
:QURY:START
	  if CDbl(StandardSundryCosts.pric)  >  0 then  
	   	  var.tppdm040.ltcp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm040.ltcp  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSundryCosts.pris)  >  0 then  
	   	  var.tppdm040.ltsp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm040.ltsp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSundryCosts
:ICOD:S
:QURY:START
select StandardSundryCosts.*
from StandardSundryCosts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSundryCosts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:153
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaterialPriceFluctuationsIndexTables
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:153
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaterialPriceFluctuationsIndexTables
:ICOD:S
:QURY:START
select MaterialPriceFluctuationsIndexTables.*
from MaterialPriceFluctuationsIndexTables
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:153
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaterialPriceFluctuationsIndexTables
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:S
:QURY:START
select  	  StandardSurchargesGeneralAndByCostType.*
from 	  StandardSurchargesGeneralAndByCostType
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:171
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByCostComponent
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:171
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByCostComponent
:ICOD:S
:QURY:START
select StandardSurchargesByCostComponent.*
from StandardSurchargesByCostComponent
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:171
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByCostComponent
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:172
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByMaterial
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:172
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByMaterial
:ICOD:S
:QURY:START
select StandardSurchargesByMaterial.*
from StandardSurchargesByMaterial
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:172
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByMaterial
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:173
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByLabor
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:173
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByLabor
:ICOD:S
:QURY:START
select StandardSurchargesByLabor.*
from StandardSurchargesByLabor
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:173
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByLabor
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:174
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByEquipment
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:174
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByEquipment
:ICOD:S
:QURY:START
select StandardSurchargesByEquipment.*
from StandardSurchargesByEquipment
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:174
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByEquipment
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:175
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySubcontracting
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:175
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySubcontracting
:ICOD:S
:QURY:START
select StandardSurchargesBySubcontracting.*
from StandardSurchargesBySubcontracting
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:175
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySubcontracting
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:176
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySundryCost
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:176
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySundryCost
:ICOD:S
:QURY:START
select StandardSurchargesBySundryCost.*
from StandardSurchargesBySundryCost
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:176
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySundryCost
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:615
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectLabors
:ICOD:D
:QURY:START
	  if CDbl(ProjectLabors.ratc)  >  0 then  
	   	  var.tppdm615.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm615.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectLabors.rats)  >  0 then  
	   	  var.tppdm615.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm615.ltrs  =  get.utc("","no")  
	  end if  
	  dump 01  	  '  |   *  tppdm615
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:615
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectLabors
:ICOD:S
:QURY:START
select ProjectLabors.*
from ProjectLabors
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:615
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectLabors
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:D
:QURY:START
	  if CDbl(ProjectEquipments.ratc)  >  0 then  
	   	  var.tppdm625.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectEquipments.rats)  >  0 then  
	   	  var.tppdm625.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrs  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectEquipments.ratp)  >  0 then  
	   	  var.tppdm625.ltrp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrp  =  get.utc("","no")  
	  end if  
	  dump 01  	  '  |   *  tppdm625
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:S
:QURY:START
select ProjectEquipments.*
from ProjectEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:D
:QURY:START
	  if CDbl(ProjectSubcontractings.pric)  >  0 then  
	   	  var.tppdm635.ltpc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltpc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSubcontractings.pris)  >  0 then  
	   	  var.tppdm635.ltps  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltps  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSubcontractings.prip)  >  0 then  
	   	  var.tppdm635.ltpp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltpp  =  get.utc("","no")  
	  end if  
	  dump 01  	  '  |   *  tppdm635
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:S
:QURY:START
select ProjectSubcontractings.*
from ProjectSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:640
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSundryCostCodes
:ICOD:D
:QURY:START
	  if Cdbl(ProjectSundryCostCodes.pric)  >  0 then  
	   	  var.tppdm640.ltpr  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm640.ltpr  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSundryCostCodes.pris)  >  0 then  
	   	  var.tppdm640.ltsp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm640.ltsp  =  get.utc("","no")  
	  end if  
	  dump 01  	  '  |   *  tppdm640
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:640
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSundryCostCodes
:ICOD:S
:QURY:START
select ProjectSundryCostCodes.*
from ProjectSundryCostCodes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:640
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSundryCostCodes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:643
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectRevenues
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:643
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectRevenues
:ICOD:S
:QURY:START
select ProjectRevenues.*
from ProjectRevenues
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:643
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectRevenues
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:740
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectBusinessPartners
:ICOD:D
:QURY:START
	  var.tppdm740.rate  =  ProjectBusinessPartners.rate  
	  if trim(var.tppdm740.rate)  =  "" or IsNull(var.tppdm740.rate) then  
	   	  var.tppdm740.rate  =  1  
	  end if  
	  var.tppdm740.raca  =  ProjectBusinessPartners.raca  
	  if trim(var.tppdm740.raca)  =  "" or IsNull(var.tppdm740.raca) then  
	   	  var.tppdm740.raca  =  1  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:740
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectBusinessPartners
:ICOD:S
:QURY:START
select ProjectBusinessPartners.*
from ProjectBusinessPartners
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:740
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectBusinessPartners
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:741
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractAmountsByBusinessPartners
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:741
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractAmountsByBusinessPartners
:ICOD:S
:QURY:START
select ProjectContractAmountsByBusinessPartners.*
from ProjectContractAmountsByBusinessPartners
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pdm
:TFLNO:741
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractAmountsByBusinessPartners
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pss
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Baselines
:ICOD:D
:QURY:START
	  if Baselines.crdt  =  "" or IsNull(Baselines.crdt) then  
	   	  var.tppss020.crdt  =  get.utc(date(),"yes")  
	  else  
	   	  var.tppss020.crdt  =  get.utc(Baselines.crdt,"yes")  
	  end if  
	  if (Baselines.apdt  =  "" or IsNull(Baselines.apdt)) and Baselines.bsta  =  2 then  
	   	  var.tppss020.apdt  =  get.utc(date(),"no")  
	  else  
	   	  var.tppss020.apdt  =  get.utc(Baselines.apdt,"no")  
	  end if  
	  if Baselines.lupd  =  "" or IsNull(Baselines.lupd) then  
	   	  var.tppss020.lupd  =  get.utc(date(),"yes")  
	  else  
	   	  var.tppss020.lupd  =  get.utc(Baselines.lupd,"yes")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pss
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Baselines
:ICOD:S
:QURY:START
select Baselines.*
from Baselines
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pss
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Baselines
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:D
:QURY:START
	  varstr.project  =  Activities.cprj  
	  var.btco  =  1  	   	   	   	  '  |  Default is 'Element'  
	  var.invm  =  3  	   	   	  '  |  Default is 'Installment'  
	  var.secu  =  ""  
	  var.prss  =  0.0000  
	  var.rtse.1  =  0.000000  
	  var.rtse.2  =  0.000000  
	  var.rtse.3  =  0.000000  
	  var.rfse.1  =  0  
	  var.rfse.2  =  0  
	  var.rfse.3  =  0  
	  var.prin  =  4  	   	   	   
	  var.cspt  =  3  	   	   	   
	  var.setl  =  2  
	  var.gris  =  0  
	  select Projects.invm,  
	   	  Projects.btco  
	  from  	  Projects  
	  where Projects.cprj  =  varstr.project  
	  selectdo  
	   	  var.invm  =  Projects.invm  	  '  |  Invoice Type  
	   	  var.btco  =  Projects.btco  	  '  |  Control By  
	  endselect  
	  '  |  Check if 'Invoice Type'  =  Progress Invoice and 'Control By'  =  Activity  	   
	  if var.invm  =  4 and var.btco  =  2 then  	   	   
	   	  var.secu  =  Activities.secu  
	   	  var.prss  =  Activities.prss  
	   	  var.rtse.1  =  Activities.rtse  
	   	  var.rtse.2  =  0.000001  
	   	  var.rtse.3  =  0.000001  
	   	  var.rfse.1  =  Activities.rfse  
	   	  var.rfse.2  =  1  
	   	  var.rfse.3  =  1  
	   	  var.prin  =  Activities.prin  
	   	  '  |  Determine field 'Progress for Invoice'  
	   	  if var.prin  =  3 then  
	   	   	  var.cspt  =  2 '  |  Indirect  
	   	  end if  
	   	  '  |  Determine field 'To Be Settled'  
	   	  if var.prin  =  1 and var.cspt  =  1 then  
	   	   	  var.setl  =  Activities.setl  
	   	  end if  
	   	  if var.prin  =  2 and var.cspt  =  1 then  
	   	   	  var.setl  =  Activities.setl  
	   	  end if  
	   	  '  |  Determine field 'Group Indirect Work'  
	   	  if var.prin  =  1 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	   	  if var.prin  =  2 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	   	  if var.prin  =  3 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	  end if  
	  '  |  In case Actual Finish Date is filled the Actual Start Date must be empty  !   
	  var.asdt  =  Activities.asdt  
	  if trim(Activities.afdt)  <>  "" then  
	   	  var.asdt  =  ""  
	  end if  
	  dump 01  	  '  |   *  tppss200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:S
:QURY:START
select Activities.*
from Activities
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pss
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ActivityBaseline
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pss
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ActivityBaseline
:ICOD:S
:QURY:START
select ActivityBaseline.*
from ActivityBaseline
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:pss
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ActivityBaseline
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:S
:QURY:START
select Extensions.*
from Extensions
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:D
:QURY:START
	  var.prin  =  Elements.prin  
	  '  |  Condition for field 'Progress for Invoice'  
	  var.cspt  =  Elements.cspt  
	  if var.prin  =  2 then  	  '  |  No  
	   	  var.cspt  =  3  	  '  |  Not Applicable  
	  end if  
	  if var.prin  =  3 then  	  '  |  Project Physical Progress  
	   	  var.cspt  =  2  	  '  |  Indirect  
	  end if  
	  '  |  Condition for field 'To Be Settled'  
	  var.setl  =  2  
	  if var.prin  =  1 and var.cspt  =  1 then  
	   	  var.setl  =  Elements.setl  
	  end if  
	  dump 01  	  '  |   *  tpptc100
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:S
:QURY:START
select Elements.*
from Elements
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:D
:QURY:START
	  if Texts.TextID  <>  "NULL" then  
	   	  TextLength  =  len(Texts.Text )  
	   	  TextNumber  =  Texts.TextID  
	   	  TextSequence  =  1  
	   	  HEXcode  =  Right("00000000"  &  Hex(TextNumber), 8)  
	   	  for p  =  1 To 7 Step 2  
	   	   	  VarTextNumber  =  VarTextNumber  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	  next  
	   	  HEXcode  =  right ( "00000000"  &  HEX ( TextSequence ) , 8 )  
	   	  for p  =  1 to 7 Step 2  
	   	   	  VarTextSequence  =  VarTextSequence  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	  next  
	   	  i  =  1  
	   	  PrevPos  =  i  
	   	  NumOfCharacters  =  0  
	   	  Do while i  <=  TextLength  
	   	   	  '  |  TextBox needs to be split in multiple text lines  
	   	   	  TextCharacter  =  MID(Texts.Text ,i,1)  
	   	   	  if (NumOfCharacters  >=  240) then  
	   	   	   	  '  |  Create current text as a sequence line.  
	   	   	   	  TextString  =  TextString  +  EndTextString  
	   	   	   	  dump 1  	  '  |   **  TTTXT010  	   
	   	   	   	   
	   	   	   	  '  |  reset fields for next text sequence line.  
	   	   	   	  TextString  =  ""  	   	   	   
	   	   	   	  VarTextNumber  =  ""  	   	   	   
	   	   	   	  VarTextSequence  =  ""  	   	   
	   	   	   	  TextSequence  =  TextSequence  +  1  
	   	   	   	  PrevPos  =  i  
	   	   	   	  NumOfCharacters  =  0  
	   	   	   	   
	   	   	   	  HEXcode  =  Right("00000000"  &  Hex(TextNumber), 8)  
	   	   	   	  for p  =  1 To 7 Step 2  
	   	   	   	   	  VarTextNumber  =  VarTextNumber  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	   	   	  next  
	   	   	   	  HEXcode  =  right ( "00000000"  &  HEX ( TextSequence ) , 8 )  
	   	   	   	  for p  =  1 to 7 Step 2  
	   	   	   	   	  VarTextSequence  =  VarTextSequence  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	   	   	  next  
	   	   	  end if  
	   	   
	   	   	   
	   	   	  '  |  Check for Enter in text  
	   	   	  if (ASC (TextCharacter)  =  13) then  
	   	   	   	  TextCharacter  =  CHR(10)  	   	   	   
	   	   	   	  i  =  i  +  2  
	   	   	  else  
	   	   	   	  TextCharacter  =  TextCharacter  	   	   
	   	   	   	  i  =  i  +  1  
	   	   	  end if  
	   	   	  '  |  Check for TAB in text  
	   	   	  if (ASC (TextCharacter)  =  9) then  
	   	   	   	  CHRspace  =  CHR (32)  
	   	   	   	  TextCharacter  =  ""  	   	   	   	   	   	   	   
	   	   	   	  for p  =  1 to 6  	   	  '  |  Replace TAB with 6 spaces  	   	   	   	   
	   	   	   	   	  TextCharacter  =  TextCharacter  +  CHRspace  	   	   	   
	   	   	   	  next  	   
	   	   	   	  NumOfCharacters  =  NumOfCharacters  +  5  	   	   	   	   	   
	   	   	  end if  	   
	   	   	  TextString  =  TextString  +  TextCharacter  
	   	   	  NumOfCharacters  =  NumOfCharacters  +  1  
	   	  loop  
	   	   
	   	  '  |  Text line is maximum of 239 and fits in 1 text line  
	   	  TextString  =  TextString  +  CHR (10) '  |  Close Character of the string  
	   	   	   	   	   
	   	  '  |  Fill up the remainder of the string with spaces  
	   	  '  |  240  =  NumOfCharacters  +  Close chararter  +  NrOfSpaces  
	   	  NrOfSpaces  =  239  -  NumOfCharacters  	   	   	   	   
	   	  CHRspace  =  CHR ( 32 )  	   	   	   	   	   	   	   	   	   
	   	  for p  =  1 to NrOfSpaces  	   	   	   	   	   	   	   	   
	   	   	  TextString  =  TextString  +  CHRspace  	   	   	   	   
	   	  next  	   	   	   	   	   	   	   	   
	   	   	   	   	   	   	   	   
	   	  TextString  =  TextString  +  EndTextString  
	   	   
	   	  dump 1  	   	  '  |   **  TTTXT010  
	   	  TextString  =  ""  	   	   	   	   	   	   	   
	   	  VarTextNumber  =  ""  	   	   	   	   	   	   	   
	   	  VarTextSequence  =  ""  	   	   	   	   	   	   
	   	  dump 2  	   	  '  |   **  TTTXT002  
	   	  dump 3  	   	  '  |   **  TTTXT001  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:S
:QURY:START
select  	  Texts.*
from 	  Texts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:D
:QURY:START
	  var.whltc100.ldat  =  LotsByItem.LotDate  
	  if var.whltc100.ldat  =  "" or IsNull(var.whltc100.ldat) then  
	   	  var.whltc100.ldat  =  Date()  
	  end if  
	  dump 100 '  |  Lots
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:S
:QURY:START
select  	  LotsByItem.*
from 	  LotsByItem
order by LotsByItem.Project, LotsByItem.Item, LotsByItem.Lot
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:9
:VERS:A2LN
:RELE:a9
:CUST:fp9
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:D
:QURY:START
	  var.bpmdm001.sdte  =  get.date(EmployeesPeople.FirstDateEmployment,"yes")  
	  var.bpmdm001.edte  =  get.date(EmployeesPeople.LastDateEmployment,"no")  
	  var.bpmdm001.daob  =  get.date(EmployeesPeople.DateBirth,"no")  
	  dump 001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:S
:QURY:START
select EmployeesPeople.*
from EmployeesPeople
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:com
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Employees
:ICOD:D
:QURY:START
dump 001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:com
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Employees
:ICOD:S
:QURY:START
select Employees.*
from Employees
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:com
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Employees
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:D
:QURY:START
	  varstr.bp  =  BusinessPartner.BusinessPartner  
	  CustomerRoles  =  0  
	  SupplierRoles  =  0  
	  if BusinessPartner.SearchKey  <>  "" then  
	   	  var.tccom100.seak  =  UCase(Left(BusinessPartner.SearchKey,16))  
	  else  
	   	  var.tccom100.seak  =  UCase(Left(BusinessPartner.Name,16))  
	  end if  
	  var.tccom100.stdt  =  get.utc(BusinessPartner.StartDate, "no")  
	  if BusinessPartner.SoldTo  =  1 then  
	   	  CustomerRoles  =  1  
	   	  dump 110 '  |   #  tccom110  
	  end if  
	  if BusinessPartner.ShipTo  =  1 then  
	   	  if Trim(BusinessPartner.ShipToAddress)  <>  "" then  
	   	   	  varstr.address  =  BusinessPartner.ShipToAddress  
	   	  else  
	   	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  end if  
	   	  CustomerRoles  =  1  
	   	  dump 111 '  |   #  tccom111  
	  end if  
	  if BusinessPartner.InvoiceTo  =  1 then  
	   	  if Trim(BusinessPartner.InvoiceToAddress)  <>  "" then  
	   	   	  varstr.address  =  BusinessPartner.InvoiceToAddress  
	   	  else  
	   	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  end if  
	   	  CustomerRoles  =  1  
	   	  var.tccom112.edci  =  get.utc(BusinessPartner.ExpiryDateInsuredCredit,"no")  
	   	  dump 112 '  |   #  tccom112  
	  end if  
	  if BusinessPartner.PayBy  =  1 then  
	   	  CustomerRoles  =  1  
'  |  243210.sn  
	   	  var.tccom114.cban  =  ""  
	   	  select BankAccountsByPayByBP.*   
	   	  from BankAccountsByPayByBP  
	   	  where BankAccountsByPayByBP.PayByBusinessPartner  =  varstr.bp  
	   	  order by BankAccountsByPayByBP.BankAccountCode desc  
	   	  selectdo  
	   	   	  var.tccom114.cban  =  BankAccountsByPayByBP.BankAccountCode  
	   	  endselect  
'  |  243210.en  
	   	  dump 114 '  |   #  tccom114  
	  end if  
	  if BusinessPartner.BuyFrom  =  1 then  
	   	  SupplierRoles  =  1  
	   	  dump 120 '  |   #  tccom120  
	  end if  
	  if BusinessPartner.ShipFrom  =  1 then  
	   	  SupplierRoles  =  1  
	   	  dump 121 '  |   #  tccom121  
	  end if  
	  if BusinessPartner.InvoiceFrom  =  1 then  
	   	  SupplierRoles  =  1  
'  |  FP7.sn  	   	   
	   	  var.tccom122.cadr  =  BusinessPartner.AddressCode  
	   	  var.tccom122.rtyp  =  BusinessPartner.ExchangeRateType  
	   	  var.tccom122.crlr  =  BusinessPartner.CreditLimit  
	   	  if Not IsNull(BusinessPartner.CreditLimit) then  
	   	   	  var.tccom122.crlr  =  BusinessPartner.CreditLimit  
	   	  else  
	   	   	  var.tccom122.crlr  =  0.0  
	   	  end if  	   	   	   
	   	  var.tccom122.cpay  =  BusinessPartner.TermsPayment  
	   	  var.tccom122.ccrs  =  BusinessPartner.LatePaymentSurcharge  
	   	  var.tccom122.paym  =  BusinessPartner.PaymentMethod  
	   	  varstr.businesspartner  =  BusinessPartner.BusinessPartner  
	   	  select BusinessPartnerExtension.*   
	   	  from BusinessPartnerExtension  
	   	  where BusinessPartnerExtension.BusinessPartner  =  varstr.businesspartner  
	   	  selectdo  
	   	   	  if BusinessPartnerExtension.AddressCodeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.cadr  =  BusinessPartnerExtension.AddressCodeInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.ExchangeRateTypeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.rtyp  =  BusinessPartnerExtension.ExchangeRateTypeInvFrom  
	   	   	  end if  	   	   
	   	   	  if Not IsNull(BusinessPartnerExtension.CreditLimitInvFrom) then  
	   	   	   	  var.tccom122.crlr  =  BusinessPartnerExtension.CreditLimitInvFrom  
	   	   	  end if  	   	   
	   	   	  if BusinessPartnerExtension.TermsPaymentInvFrom  <>  "" then  
	   	   	   	  var.tccom122.cpay  =  BusinessPartnerExtension.TermsPaymentInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.LatePaymentSurchargeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.ccrs  =  BusinessPartnerExtension.LatePaymentSurchargeInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.PaymentMethodInvFrom  <>  "" then  
	   	   	   	  var.tccom122.paym  =  BusinessPartnerExtension.PaymentMethodInvFrom  
	   	   	  end if  
	   	  endselect  
|  FP7.en  
	   	  dump 122 '  |   #  tccom122  
	  end if  
	  if BusinessPartner.PayTo  =  1 then  
	   	  SupplierRoles  =  1  
'  |   *  Determine Bank Code  
'  |   *   #  42.sn  
	   	  var.tccom124.cban  =  ""  
	   	  select BankAccountsByPayToBP.*   
	   	  from  	  BankAccountsByPayToBP  
	   	  where BankAccountsByPayToBP.PayToBusinessPartner  =  varstr.bp  
	   	  order by BankAccountsByPayToBP.BankAccountCode desc  
	   	  selectdo  
	   	   	  var.tccom124.cban  =  BankAccountsByPayToBP.BankAccountCode  
	   	  endselect  
'  |   *   #  42.en  
	   	  dump 124 '  |   #  tccom124  
	  end if  
	  if CustomerRoles  =  0 then  
	   	  if SupplierRoles  =  0 then  
	   	   	  var.tccom100.bprl  =  1  
	   	  else  
	   	   	  var.tccom100.bprl  =  3  
	   	  end if  
	  else  
	   	  if SupplierRoles  =  0 then  
	   	   	  var.tccom100.bprl  =  2  
	   	  else  
	   	   	  var.tccom100.bprl  =  4  
	   	  end if  
	  end if  
	  dump 100 '  |   #  tccom100  
	  If BusinessPartner.TaxNumber  <>  "" then  
	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  var.tctax400.ccty  =  ""  
	   	  select  	  Addresses.*   
	   	  from  	  Addresses  
	   	  where  	  Addresses.AddressCode  =  varstr.address  
	   	  selectdo  
	   	   	  var.tctax400.ccty  =  Addresses.Country  
	   	  endselect  
	   	  dump 400 '  |   #  tctax400  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:S
:QURY:START
select  	  BusinessPartner.*
from 	  BusinessPartner
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:D
:QURY:START
	  if trim(Contacts.SearchKey)  <>  "" then  
'  |   	   	  var.tccom140.seak  =  Ucase(Left(Contact.SearchKey,16)) '  |   *  249609.o  
	   	  var.tccom140.seak  =  Ucase(Left(Contacts.SearchKey,16)) '  |   *  249609.n  
	  else  
	   	  var.tccom140.seak  =  Ucase(Left(Contacts.FamilyName, 16))  
	  end if  
	   
	  var.tccom140.fuln  =  trim (Contacts.GivenName)  &  " "  &  trim(Contacts.MiddleName)  &  " "  &  trim(Contacts.FamilyName)  
	   
	  var.tccom140.bthd  =  get.date(Contacts.BirthDay,"no")  
	  var.tccom140.pelp  =  2  
	  var.tccom140.peld  =  2  
	  var.tccom140.pehm  =  2  
	  var.tccom140.pelm  =  2  
	  if trim (Contacts.Telephone)  <>  "" then  
	   	  var.tccom140.pelp  =  1 '  |  yes if Office phone filled  
	  else  
	   	  if trim (Contacts.Cellphone)  <>  "" then  
	   	   	  var.tccom140.pelm  =  1 '  |  yes If Mobile phone is filled  
	   	  else  
	   	   	  if trim (Contacts.PhonePrivate)  <>  "" then  
	   	   	   	  var.tccom140.pehm  =  1 '  |  yes If private phone is filled  
	   	   	  else  
	   	   	   	  if trim (Contacts.DirectDial)  <>  "" then  
	   	   	   	   	  var.tccom140.peld  =  1 '  |  yes If Direct Dial is filled  
	   	   	   	  end if  
	   	   	  end if  
	   	  end if  	   
	  end if  	   
	  dump 140  	  '  |   #  tccom140
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:S
:QURY:START
select Contacts.*
from Contacts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:D
:QURY:START
'  |   **********************************************************************************************   
'  |  Function Flow  
'  |  1  -  Setting of some global variables.  
'  |  2  -  For each dump table  
'  |   	   	  a  -  Handle defaulting fields not in the item access table  
'  |   	   	  b  -  Handle defaulting fields als in item access table  
'  |   	   	  c  -  All other variables for the dump table are set.  
'  |   	   	  Based upon specific values in the Item Access table a variable is set which is  
'  |   	   	  used in the dumps.  
'  |  3  -  Dump section for all tables.  
'  |   	   
'  |   **********************************************************************************************   
	  varstr.cprj  	   	   =  Items.Project  
	  varstr.item  	   	   =  Items.Item  
	  varstr.itemgroup  	   =  Items.ItemGroup  	   	   	   	   
	  varint.itemtype  	   =  Items.ItemType  
	  if Items.Exception  =  0 then  
	   	  Items.Exception  =  1  
	  end if  	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for General Data (tcibd001)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsGeneral.*   
	  from  	   	  ItemDefaultsGeneral  
	  where  	   	  ItemDefaultsGeneral.kitm  =  varint.itemtype And ItemDefaultsGeneral.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tcibd001.ccfg  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ccfg, "", Items.Exception, DefaultFound)  	  'LN10_4.n  
	  var.tcibd001.exin  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.exin, "", Items.Exception, DefaultFound)  
	   
	  var.tcibd001.chma  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.chma, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.cnfg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.cnfg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.dpcr  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpcr, 0, Items.Exception, DefaultFound, 100)  
	  var.tcibd001.dpeg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpeg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.dptp  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dptp, 0, Items.Exception, DefaultFound, 90)  
	  var.tcibd001.dpuu  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpuu, 0, Items.Exception, DefaultFound, 2)  	   	   
	  var.tcibd001.edco  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.edco, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.eitm  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.eitm, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.icsi  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.icsi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tcibd001.itmt  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.itmt, 0, Items.Exception, DefaultFound, 10)  
	  var.tcibd001.ippg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ippg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.mcoa  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.mcoa, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.ppeg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ppeg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.psiu  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.psiu, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.sayn  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.sayn, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.styp  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.styp, 0, Items.Exception, DefaultFound, 1)  
	  var.tcibd001.subc  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.subc, 0, Items.Exception, DefaultFound, 2)  
	   
	  'Defaults presents and present in Item access table  
	  var.tcibd001.ccde  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ccde, Items.CommodityCode, Items.Exception, DefaultFound)  
	  var.tcibd001.cean  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cean, Items.EANCode, Items.Exception, DefaultFound)  
	  var.tcibd001.cmnf  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cmnf, Items.Manufacturer, Items.Exception, DefaultFound)  
	  var.tcibd001.cood  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cood, Items.TechnicalCoordinator, Items.Exception, DefaultFound)  
	  var.tcibd001.cpcl  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpcl, Items.ProductClass, Items.Exception, DefaultFound)  
	  var.tcibd001.cpcp  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpcp, Items.CostComponent, Items.Exception, DefaultFound)  
	  var.tcibd001.cpln  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpln, Items.ProductLine, Items.Exception, DefaultFound)  
	  var.tcibd001.csel  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.csel, Items.SelectionCode, Items.Exception, DefaultFound)  
	  var.tcibd001.csig  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.csig, Items.ItemSignal, Items.Exception, DefaultFound)  
	  var.tcibd001.ctyo  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ctyo, Items.CountryOrigin, Items.Exception, DefaultFound)  
	  var.tcibd001.ctyp  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ctyp, Items.ProductType, Items.Exception, DefaultFound)  
	  var.tcibd001.cuni  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cuni, Items.InventoryUnit, Items.Exception, DefaultFound)  
	  var.tcibd001.dscb  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscb, Items.Material, Items.Exception, DefaultFound)  
	  var.tcibd001.dscc  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscc, Items.Size, Items.Exception, DefaultFound)  
	  var.tcibd001.dscd  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscd, Items.Standard, Items.Exception, DefaultFound)  
	  var.tcibd001.uset  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.uset, Items.UnitSet, Items.Exception, DefaultFound)  
	  var.tcibd001.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.txta, Items.TextIDGeneral, Items.Exception, DefaultFound)  
	  if Items.WeightUnit  =  "" then  
	   	  var.tcibd001.cwun  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cwun, var.weight.unit, Items.Exception, DefaultFound)  
	   	  var.tcibd001.wght  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.wght, 0, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd001.cwun  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cwun, Items.WeightUnit, Items.Exception, DefaultFound)  
	   	  var.tcibd001.wght  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.wght, Items.Weight, Items.Exception, DefaultFound)  
	  end if  
	  var.tcibd001.srce  =  DetermineSrce(Items.ItemType)  
	  var.tcibd001.srce  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.srce, var.tcibd001.srce, Items.Exception,DefaultFound, 10)  
'  |   **********************************************************************************************   
'  |  In case of Lot Controlled (tcibd001)  	   	   
'  |   **********************************************************************************************   
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tcibd001.ltct  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ltct, Items.LotControlled, Items.Exception, DefaultFound, 2)  
	  else  
	   	  var.tcibd001.ltct  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ltct, 2, Items.Exception, DefaultFound, 2)  
	  end if  
	   
'  |   **********************************************************************************************   
'  |  In case of Serialized Items (tcibd001)  
'  |   **********************************************************************************************   
	  If Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tcibd001.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.seri, Items.Serialized, Items.Exception, DefaultFound, 2)  	   
	  else  
	   	  var.tcibd001.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.seri, 2, Items.Exception, DefaultFound, 2)  	   	   
	  end if  
	   	   
'  |   **********************************************************************************************   
'  |  Settings for General Item data (tcibd001)  
'  |   **********************************************************************************************   
	  if Items.SearchKeyI  <>  "" then  
	   	  var.tcibd001.seak  =  UCase(Left(Items.SearchKeyI, 16))  
	  else  
	   	  var.tcibd001.seak  =  UCase(Left(Items.ItemDescription, 16))  
	  end if  
	   
	  if Items.SearchKeyII  <>  "" then  
	   	  var.tcibd001.seab  =  UCase(Left(Items.SearchKeyII, 16))  
	  else  
	   	  var.tcibd001.seab  =  UCase(Left(Items.Item, 16))  
	  end if  
	   
'  |   **********************************************************************************************   
'  |  Settings for Alternative Items (tcibd001)  
'  |   **********************************************************************************************   
	  var.tcibd001.repl  =  5  	   	   	   	   	   	  '  |  Not Applicable  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where ( AlternativeItems.Project  =  "" and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  10  	   	   	   	  '  |  Replaced  
	   	  endselect  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  "" and AlternativeItems.AlternativeItem  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  15  	   	   	   	  '  |  Substitute  
	   	  endselect  
	  else  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  varstr.cprj and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  10  	   	   	   	  '  |  Replaced  
	   	  endselect  
	  end if  
	   
	   
	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Costing Data (ticpr007)  
'  |   **********************************************************************************************   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsCosting.*   
	  from  	  ItemDefaultsCosting  
	  where  	  ItemDefaultsCosting.kitm  =  varint.itemtype And ItemDefaultsCosting.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.ticpr007.chrt  =  ItemHandling.GetTypeString(ItemDefaultsCosting.chrt, "", Items.Exception, DefaultFound)  	   
	  var.ticpr007.lcst  =  ItemHandling.GetTypeString(ItemDefaultsCosting.lcst, "", Items.Exception, DefaultFound)  
	  var.tcibd007.inlc  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.inlc, 0, Items.Exception, DefaultFound, 2)  
	   
	  'Defaults presents and present in Item access table  
	  var.tcibd007.acpm  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpm, Items.AggregatedMaterialCostCompo, Items.Exception, DefaultFound)  
	  var.tcibd007.ccur  =  ItemHandling.GetTypeString(ItemDefaultsCosting.ccur, Items.CostingCurrency, Items.Exception, DefaultFound)  
	  var.tcibd007.spit  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.spit, Items.SurchargesbyItem, Items.Exception, DefaultFound, 2)  
	  var.tcibd007.vpwh  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.vpwh, Items.SurchargesbyWarehouse, Items.Exception, DefaultFound, 2)  
	   
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tcibd007.acpo  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpo, Items.AggregatedOperationCostComp, Items.Exception, DefaultFound)  
	   	  var.tcibd007.acps  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acps, Items.AggregatedSurchargeCostComp, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd007.acpo  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpo, "", Items.Exception, DefaultFound)  
	   	  var.tcibd007.acps  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acps, "", Items.Exception, DefaultFound)  
	  end if  
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Purchase Data (tdipu001)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsPurchase.*   
	  from  	  ItemDefaultsPurchase  
	  where  	  ItemDefaultsPurchase.kitm  =  varint.itemtype And ItemDefaultsPurchase.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  	   
	   
	  'Defaults presents but not in Item access table  	   
	  var.tdipu001.cncd  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cncd, "", Items.Exception, DefaultFound)  	  'LN10_4.n  
	   
	  var.tdipu001.rtdm  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtdm, 0, Items.Exception, DefaultFound)  
	  var.tdipu001.rtdp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtdp, 0, Items.Exception, DefaultFound)  	   
	  var.tdipu001.rtqm  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtqm, 0, Items.Exception, DefaultFound)  
	  var.tdipu001.rtqp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtqp, 0, Items.Exception, DefaultFound)  
	   
	  var.tdipu001.acci  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.acci, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.casl  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.casl, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.cims  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.cims, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.hstq  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.hstq, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.hstd  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.hstd, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.issp  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.issp, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.mmnf  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.mmnf, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.mpyn  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.mpyn, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tdipu001.rqms  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.rqms, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.rmss  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.rmss, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tdipu001.qual  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.qual, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.vryn  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.vryn, 0, Items.Exception, DefaultFound, 1)  
	   
	  'Defaults presents and present in Item access table  
	  var.tdipu001.buyr  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.buyr, Items.Buyer, Items.Exception, DefaultFound)  
	  var.tdipu001.ccur  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.ccur, Items.PurchaseCurrency, Items.Exception, DefaultFound)  
	  var.tdipu001.cofc  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cofc, Items.PurchaseOffice, Items.Exception, DefaultFound)  
	  var.tdipu001.cpgp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cpgp, Items.PurchasePriceGroup, Items.Exception, DefaultFound)  
	  var.tdipu001.csgp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.csgp, Items.PurchaseStatisticsGroup, Items.Exception, DefaultFound)  
	  var.tdipu001.cupp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cupp, Items.PurchasePriceUnit, Items.Exception, DefaultFound)  
	  var.tdipu001.cuqp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cuqp, Items.PurchaseUnit, Items.Exception, DefaultFound)  
	  var.tdipu001.cvat  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cvat, Items.TaxCodePurchase, Items.Exception, DefaultFound)  
	  var.tdipu001.otbp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.otbp, Items.BuyFromBusinessPartner, Items.Exception, DefaultFound)  
	  var.tdipu001.txtp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.txtp, Items.TextIDPurchase, Items.Exception, DefaultFound)  
	   
	  If Items.ItemType  =  4 then  
	   	  var.tdipu001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.retw, 2, Items.Exception, DefaultFound, 1)  
	   	  var.tdipu001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cwar, "", Items.Exception, DefaultFound)  
	  else  
	   	  var.tdipu001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.retw, 1, Items.Exception, DefaultFound, 1)  
	   	  var.tdipu001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cwar, Items.Warehouse, Items.Exception, DefaultFound)  
	  end if  
	   
	  If Items.SupplyTime  <  "0" then  
	   	  'Set value to zero in case it is smaller than zero  
	   	  var.tdipu001.suti  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.suti, 0, Items.Exception, DefaultFound)  	   
	  else  	   
	   	  var.tdipu001.suti  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.suti, Items.SupplyTime, Items.Exception, DefaultFound)  	   
	  end if  
	   
	  If Items.UnitforSupplyTime  =  "" then  
	   	  ' Set access value to 10 in case it is empty  
	   	  var.tdipu001.sutu  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sutu, 10, Items.Exception, DefaultFound, 10)  
	  Else  
	   	  var.tdipu001.sutu  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sutu, Items.UnitforSupplyTime, Items.Exception, DefaultFound, 10)  	   
	  End If  
	  var.tdipu001.sopr  =  set.source.of.price(Items.ItemType)  	  '  |  Fp9.n  
	  var.tdipu001.sopr  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sopr, var.tdipu001.sopr, Items.Exception, DefaultFound, 3)  
	   	   	   	   	   	   	   	   	   	   	  'LN10_4.sn  
	  var.tdipu001.sops  =  set.source.of.price.for.service.subcontracting(Items.ItemType)  
	  var.tdipu001.sops  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sopr, var.tdipu001.sops, Items.Exception, DefaultFound, 3)  
	   
	  var.tdipu001.prip  =  get.purchase.price(Items.ItemType, Items.PurchasePrice)  
	   	   	   	   	   	   	   	   	   	   	  'LN10_4.en  
	   
	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Sales Data (tdisa001)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsSales.*   
	  from  	  ItemDefaultsSales  
	  where  	  ItemDefaultsSales.kitm  =  varint.itemtype And ItemDefaultsSales.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tdisa001.lmsp  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.lmsp, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.mnra  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.mnra, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.mmtl  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.mmtl, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.qidd  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qidd, 9999999.99, Items.Exception, DefaultFound)  
	  var.tdisa001.qimc  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qimc, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.qimo  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qimo, 1, Items.Exception, DefaultFound)  
	  var.tdisa001.umsp  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.umsp, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.cmgp  =  ItemHandling.GetTypeString(ItemDefaultsSales.cmgp, "", Items.Exception, DefaultFound)  
	  var.tdisa001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsSales.cwar, "", Items.Exception, DefaultFound)  
	  var.tdisa001.rbgp  =  ItemHandling.GetTypeString(ItemDefaultsSales.rbgp, "", Items.Exception, DefaultFound)  
	   
	  var.tdisa001.acci  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.acci, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.acom  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.acom, 0, Items.Exception, DefaultFound, 1)  
	  var.tdisa001.actn  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.actn, 0, Items.Exception, DefaultFound, 3)  
	  var.tdisa001.alod  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.alod, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.cphl  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.chpl, 0, Items.Exception, DefaultFound, 5)  	   
	  var.tdisa001.rcom  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.rcom, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.scon  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.scon, 0, Items.Exception, DefaultFound, 10)  
	  var.tdisa001.tltp  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.tltp, 0, Items.Exception, DefaultFound, 3)  
	  'Defaults presents and present in Item access table  
	  var.tdisa001.cpgs  =  ItemHandling.GetTypeString(ItemDefaultsSales.cpgs, Items.SalesPriceGroup, Items.Exception, DefaultFound)  
	  var.tdisa001.csgs  =  ItemHandling.GetTypeString(ItemDefaultsSales.csgs, Items.SalesStatisticsGroup, Items.Exception, DefaultFound)  
	  var.tdisa001.cups  =  ItemHandling.GetTypeString(ItemDefaultsSales.cups, Items.SalesPriceUnit, Items.Exception, DefaultFound)  
	  var.tdisa001.cuqs  =  ItemHandling.GetTypeString(ItemDefaultsSales.cuqs, Items.SalesUnit, Items.Exception, DefaultFound)  	   
	  var.tdisa001.cvat  =  ItemHandling.GetTypeString(ItemDefaultsSales.cvat, Items.TaxCodeSales, Items.Exception, DefaultFound)  
	  var.tdisa001.txts  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.txts, Items.TextIDSales, Items.Exception, DefaultFound)  
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tdisa001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.retw, 1, Items.Exception, DefaultFound, 2)  
	  else  
	   	  var.tdisa001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.retw, 2, Items.Exception, DefaultFound, 2)  
	  end if  
	   
'  |   **********************************************************************************************   	   
'  |   *  Setting variables for Item Sales Data (tdisa001)  
'  |   **********************************************************************************************   	   
	  if Items.SalesPrice  <  "0" Then  
	   	  ' minimum price is 0  
	   	  var.tdisa001.pris  =  0  
	  Else  
	   	  var.tdisa001.pris  =  Items.SalesPrice  
	  end if  
	   
	  if Items.SuggestedRetailPrice  <  "0" then  
	   	  ' minimum price is 0  
	   	  var.tdisa001.prir  =  0  
	  Else  
	   	  var.tdisa001.prir  =  Items.SuggestedRetailPrice  
	  end if  
	   
'  |   ********************************************************************************************   
'  |  It default variables for Item Ordering Data (tcibd200)  
'  |   ********************************************************************************************   
	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsOrdering.*   
	  from  	  ItemDefaultsOrdering  
	  where  	  ItemDefaultsOrdering.kitm  =  varint.itemtype And ItemDefaultsOrdering.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tcibd200.auso  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.auso, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.crmp  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.crmp, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.kctr  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.kctr, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.plpl  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.plpl, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tcibd200.ptyp  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.ptyp, 0, Items.Exception, DefaultFound, 3)  	   
	  var.tcibd200.uaoq  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.uaoq, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.wpcs  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.wpcs, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	   
	  var.tcibd200.nopr  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.nopr, 1, Items.Exception, DefaultFound)  
	  var.tcibd200.ocst  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ocst, 0, Items.Exception, DefaultFound)  
	  var.tcibd200.serv  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.serv, 0, Items.Exception, DefaultFound)  
	  var.tcibd200.csps  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.csps, "", Items.Exception, DefaultFound)  
	  var.tcibd200.cspd  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cspd, "", Items.Exception, DefaultFound)  
	  var.tcibd200.cplb  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cplb, "", Items.Exception, DefaultFound)  
	  var.tcibd200.rgrp  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.rgrp, "", Items.Exception, DefaultFound)  
	  var.tcibd200.sfpl  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.sfpl, "", Items.Exception, DefaultFound)  
	  'Defaults presents and present in Item access table  
	  var.tcibd200.cwar  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cwar, Items.Warehouse, Items.Exception, DefaultFound)  	   
	  var.tcibd200.maxs  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maxs, Items.MaximumInventory, Items.Exception, DefaultFound)  	   
	  var.tcibd200.oint  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oint, Items.OrderInterval, Items.Exception, DefaultFound)  
	  var.tcibd200.reop  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.reop, Items.Reorderpoint, Items.Exception, DefaultFound)  
	  var.tcibd200.sftm  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.sftm, Items.SafetyTime, Items.Exception, DefaultFound)  
	  var.tcibd200.sfst  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.sfst, Items.SafetyStock, Items.Exception, DefaultFound)  
	  var.tcibd200.oivu  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.oivu, Items.OrderIntervalUnit, Items.Exception, DefaultFound, 10)  
	  var.tcibd200.omth  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.omth, Items.OrderMethod, Items.Exception, DefaultFound, 1)  
	  var.tcibd200.opol  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.opol, Items.OrderPolicy, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.tuni  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.tuni, Items.SafetyTimeUnit, Items.Exception, DefaultFound, 10)  
	   
	  If Items.OrderSystem  =  4 and Items.ItemType  <>  3 then  
	   	  var.tcibd200.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.osys, 9, Items.Exception, DefaultFound, 9)  
	  else  
	   	  var.tcibd200.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.osys, Items.OrderSystem, Items.Exception, DefaultFound, 9)  
	  end if  
	  if (Items.OrderQuantityIncrement  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.oqmf  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oqmf, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.oqmf  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oqmf, Items.OrderQuantityIncrement, Items.Exception, DefaultFound)  
	  end if  	   
	  if (Items.MinimumOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.mioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.mioq, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.mioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.mioq, Items.MinimumOrderQuantity, Items.Exception, DefaultFound)  
	  end if  
	  if (Items.MaximumOrderQuantity  <=  "0") then  
	   	  var.tcibd200.maoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maoq, 9999999, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tcibd200.maoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maoq, Items.MaximumOrderQuantity, Items.Exception, DefaultFound)  	   	   
	  End if  
	  If (Items.FixedOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.fioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.fioq, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.fioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.fioq, Items.FixedOrderQuantity , Items.Exception, DefaultFound)  	   	   
	  end if  
	   
	  If (Items.EconomicOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.ecoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ecoq, 1, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tcibd200.ecoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ecoq, Items.EconomicOrderQuantity, Items.Exception, DefaultFound)  
	  End if  
'  |   **********************************************************************************************   
'  |  Item default variables for Item Production Data (tiipd001)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsProduction.*   
	  from  	  ItemDefaultsProduction  
	  where  	  ItemDefaultsProduction.kitm  =  varint.itemtype And ItemDefaultsProduction.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tiipd001.pcrp  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.pcrp, 0, Items.Exception, DefaultFound)  
	  var.tiipd001.scdl  =  ItemHandling.GetTypeString(ItemDefaultsProduction.scdl, "", Items.Exception, DefaultFound)  
	  var.tiipd001.cick  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.cick, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.drin  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.drin, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.dris  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.dris, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.iuma  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.iuma, 0, Items.Exception, DefaultFound, 10)  
	  var.tiipd001.oqdr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oqdr, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.repi  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.repi, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.smfs  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.smfs, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tiipd001.swoc  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.swoc, 0, Items.Exception, DefaultFound, 1)  	   
	   
	  'Defaults presents and present in Item access table  
	  var.tiipd001.cpha  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.cpha, Items.Phantom, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.phst  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.phst, Items.UsePhantomInventory, Items.Exception, DefaultFound, 2)  
	  If Items.BackflushIfMaterial  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfcp  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfcp,2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfcp  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfcp,Items.BackflushIfMaterial, Items.Exception, DefaultFound, 2)  
	  End If  
	  If Items.BackflushMaterials  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfep  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfep,2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfep  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfep,Items.BackflushMaterials, Items.Exception, DefaultFound, 2)  
	  End If  
	  If Items.BackflushHours  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfhr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfhr, 2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfhr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfhr,Items.BackflushHours, Items.Exception, DefaultFound, 2)  
	  End if  
	   	   	   
	  If Items.RoutingQuantity  <=  "0" Then  
	   	  'Minimum value is 1  
	   	  var.tiipd001.runi  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.runi, 1, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.runi  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.runi, Items.RoutingQuantity, Items.Exception, DefaultFound)  	   
	  End if  
	  If Items.BOMQuantity  <=  "0" then  
	   	  'Minimum value is 1  
	   	  var.tiipd001.unom  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.unom, 1, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.tiipd001.unom  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.unom, Items.BOMQuantity, Items.Exception, DefaultFound)  	   	   
	  End if  
	  If Items.ScrapFactor  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.scpf  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpf, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.scpf  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpf, Items.ScrapFactor, Items.Exception, DefaultFound)  
	  End if  
	  If Items.ScrapQuantity  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.scpq  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpq, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.scpq  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpq, Items.ScrapQuantity, Items.Exception, DefaultFound)  
	  End if  
	  If Items.OrderLeadTimeUnit  =  0 Then  
	   	  'If not defined than it will be mapped with hours (5)  
	   	  var.tiipd001.oltu  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oltu, 5 , Items.Exception, DefaultFound, 5)  
	  Else  
	   	  var.tiipd001.oltu  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oltu,Items.OrderLeadTimeUnit, Items.Exception, DefaultFound, 5)  
	  End if  
	  If Items.OrderLeadTime  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.oltm  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.oltm, 0, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.tiipd001.oltm  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.oltm, Items.OrderLeadTime, Items.Exception, DefaultFound)  
	  End if  	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Planning Data (cprpd100)  
'  |   **********************************************************************************************   	   
	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	   	  ItemDefaultsPlanning.*   
	  from  	   	  ItemDefaultsPlanning  
	  where  	   	  ItemDefaultsPlanning.kitm  =  varint.itemtype And ItemDefaultsPlanning.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.cprpd100.fite  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.fite, "", Items.Exception, DefaultFound)  
	  var.cprpd100.fide  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.fide, "", Items.Exception, DefaultFound)  
	  var.cprpd100.mrpu  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.mrpu, "", Items.Exception, DefaultFound)  
	  var.cprpd100.rpun  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.rpun, "", Items.Exception, DefaultFound)  
	  '  
	  var.cprpd100.audf  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.audf, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.auiv  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.auiv, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.aupr  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.aupr, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.aupu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.aupu, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.catp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.catp, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.chat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.chat, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.coat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.coat, 0, Items.Exception, DefaultFound, 2)  	   
	  var.cprpd100.cria  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.cria, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.depd  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.depd, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.deps  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.deps, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.efpg  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.efpg, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.fatp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.fatp, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.fica  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.fica, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.info  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.info, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.mult  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.mult, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.onat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.onat, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.pbpl  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.pbpl, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.prio  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.prio, 0, Items.Exception, DefaultFound, 5)  
	  var.cprpd100.uatt  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.uatt, 0, Items.Exception, DefaultFound, 5)  
	  var.cprpd100.upho  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.upho, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.utmf  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.utmf, 0, Items.Exception, DefaultFound, 1)  
	  '  
	  var.cprpd100.atho  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.atho, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.atta  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.atta, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.attm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.attm, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.fasi  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fasi, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.fltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fltm, 9999, Items.Exception, DefaultFound)  
	  var.cprpd100.hoat  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.hoat, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.inho  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.inho, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.retf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.retf, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.tfat  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tfat, 0, Items.Exception, DefaultFound)  
	  '  
	  'Defaults presents and present in Item access table  
	  var.cprpd100.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.osys,Items.MaintainMasterPlan, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.plvl  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.plvl, Items.PlanLevel, Items.Exception, DefaultFound)  
	  var.cprpd100.plid  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.plid, Items.Planner, Items.Exception, DefaultFound)  
	  If Items.ExtraLeadTime  <  "0" then  
	   	  ' Mimimum value is 0  
	   	  var.cprpd100.eltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.eltm, 0, Items.Exception, DefaultFound)  
	  Else  	   
	   	  var.cprpd100.eltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.eltm, Items.ExtraLeadTime, Items.Exception, DefaultFound)  
	  End if  
	  If Items.ForecastTimeFence  <  "0" then  
	   	  ' Mimimum value is 0  
	   	  var.cprpd100.fctf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fctf, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.cprpd100.fctf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fctf, Items.ForecastTimeFence, Items.Exception, DefaultFound)  	   
	  End if  
	  If Items.TimeFence  <  "0" then  
	   	  ' Mimimum value is 0  
	   	  var.cprpd100.tmfc  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tmfc, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.cprpd100.tmfc  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tmfc, Items.TimeFence, Items.Exception, DefaultFound)  
	  End if  
	  If Items.UnitForExtraLeadTime  =  0 Then  
	   	  'If not defined than it will be mapped with days (10)  
	   	  var.cprpd100.eltu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.eltu,10, Items.Exception, DefaultFound, 10)  
	  Else  	   
	   	  var.cprpd100.eltu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.eltu,Items.UnitForExtraLeadTime, Items.Exception, DefaultFound, 10)  
	  End if  
	  If Items.TimeFenceUnit  =  0 then  
	   	  'If not defined than it will be mapped with days (10)  
	   	  var.cprpd100.tmfu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.tmfu,10, Items.Exception, DefaultFound, 10)  
	  Else  
	   	  var.cprpd100.tmfu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.tmfu,Items.TimeFenceUnit, Items.Exception, DefaultFound, 10)  
	  End if  
	  If Items.OrderHorizon  <=  "0" then  
	   	  If Items.MaintainMasterPlan  =  2 then  
	   	   	  'If Items.OrderHorizon is not specified it will be defaulted based upon MaintainMastesPlan.  
	   	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, 180, Items.Exception, DefaultFound)  
	   	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, 180, Items.Exception, DefaultFound)  
	   	  Else  
	   	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, 360, Items.Exception, DefaultFound)  
	   	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, 180, Items.Exception, DefaultFound)  
	   	  End if  	   	   	   
	  Else  
	   	  If Items.MaintainMasterPlan  =  2 then  
	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  
	   	  Else  
	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  *  2  
	   	  End If  
	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, Items.OrderHorizon, Items.Exception, DefaultFound)  	   	   
	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, var.cprpd100.ptmf, Items.Exception, DefaultFound)  
	  End if  
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Warehousing Data (whwmd400)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false '  
	  select  	  ItemDefaultsWarehousing.*   
	  from  	  ItemDefaultsWarehousing  
	  where  	  ItemDefaultsWarehousing.kitm  =  varint.itemtype And ItemDefaultsWarehousing.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true '  
	  endselect  
	   	   
	  'Defaults presents but not in Item access table '  
	  var.whwmd400.cfmd  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.cfmd, "", Items.Exception, DefaultFound)  
	  var.whwmd400.pkdf  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.pkdf, "", Items.Exception, DefaultFound)  	   
	  var.whwmd400.rgtm  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.rgtm, "", Items.Exception, DefaultFound)  
	  var.whwmd400.risk  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.risk, "", Items.Exception, DefaultFound)  	   
	  var.whwmd400.ffsi  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.ffsi, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.npsl  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.npsl, 0, Items.Exception, DefaultFound)  	   
	  var.whwmd400.potc  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.potc, 0, Items.Exception, DefaultFound)  	   
	  var.whwmd400.qcma  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.qcma, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.qcmi  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.qcmi, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.txta, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.ddlt  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.ddlt, 0, Items.Exception, DefaultFound) 'LN10_4.n'  
	  var.whwmd400.alle  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.alle, 0, Items.Exception, DefaultFound, 1)  
	  var.whwmd400.askp  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.askp, 0, Items.Exception, DefaultFound, 1)  	   
	  var.whwmd400.assi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.assi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ccma  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ccma, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.coas  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.coas, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.cspr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.cspr, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ctzi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ctzi, 0, Items.Exception, DefaultFound, 5)  	   
	  var.whwmd400.dmsi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmsp  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsp, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmsr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsr, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmss  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmss, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dwhs  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dwhs, 0, Items.Exception, DefaultFound, 70)  	   
	  var.whwmd400.dycd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dycd, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.excc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.excc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.hama  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.hama, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.kpsl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.kpsl, 0, Items.Exception, DefaultFound, 4)  	   
	  var.whwmd400.lveh  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lveh, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.mabc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.mabc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.niwo  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.niwo, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.owip  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owip, 0, Items.Exception, DefaultFound, 20)  	   
	  var.whwmd400.owrl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owrl, 0, Items.Exception, DefaultFound, 10)  	   
	  var.whwmd400.owrt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owrt, 0, Items.Exception, DefaultFound, 10)  	   
	  var.whwmd400.prva  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.prva, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.spri  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.spri, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.thus  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.thus, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ufpl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ufpl, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.uhnd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.uhnd, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.vers  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.vers, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.wmsc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.wmsc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.rjha  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.rjha, 0, Items.Exception, DefaultFound, 10)  	  'LN10_4.sn '  
	  var.whwmd400.tmun  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.tmun, 0, Items.Exception, DefaultFound, 10)  
	  var.whwmd400.uidt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.uidt, 0, Items.Exception, DefaultFound, 10)  	  'LN10_4.en '  
	   
	  'Defaults presents and present in Item access table'  
	  var.whwmd400.usab  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.usab, Items.ExpectedAnnualIssue, Items.Exception, DefaultFound)  
	  var.whwmd400.ivgr  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.ivgr, Items.ItemValuationGroup, Items.Exception, DefaultFound)  
	   
	  var.whwmd400.abcc  =  Ucase(Left(Items.Abcc, 1))  
	  var.whwmd400.abcc  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.abcc, var.whwmd400.abcc, Items.Exception, DefaultFound)  
	  if Items.FloorStock  =  0 Then  
	   	  'Use default value if not specified '  
	   	  var.whwmd400.pics  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.pics, 2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.whwmd400.pics  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.pics, Items.FloorStock, Items.Exception, DefaultFound, 2)  
	  end if  
	  if Items.InventoryCarryingCosts  <  "0" Then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.scst  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.scst, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.whwmd400.scst  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.scst, Items.InventoryCarryingCosts, Items.Exception, DefaultFound)  	   	   	   	   
	  End if  
	   
	  if Items.Height  <  "0" Then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.hght  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.hght, 0, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.whwmd400.hght  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.hght, Items.Height, Items.Exception, DefaultFound)  
	  end if  
	  if Items.Width  <  "0" Then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.wdth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.wdth, 0, Items.Exception, DefaultFound)  	   
	  Else  
	   	  var.whwmd400.wdth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.wdth, Items.Width, Items.Exception, DefaultFound)  
	  end if  
	  if Items.Depth  <  "0" then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.dpth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.dpth, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.whwmd400.dpth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.dpth, Items.Depth, Items.Exception, DefaultFound)  	   	   
	  end if  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case of Outbound Method  
'  |   **********************************************************************************************   
	  if Items.OutboundMethod  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.obpr  =  2 ' FIFO  
	  end if  
	   
	  If Items.ItemType  =  4 Then  
	   	  'Set default values in case of cost items  
	   	  var.whwmd400.obpr  =  3 ' By Location  
	  end if  
	  var.whwmd400.obpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.obpr, var.whwmd400.obpr, Items.Exception, DefaultFound, 3)  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case of Location Controlled  
'  |   **********************************************************************************************   	   
	  if Items.LocationControlled  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.locc  =  1 ' Yes  
	  Else  
	   	  var.whwmd400.locc  =  Items.LocationControlled  
	  End if  
	  If Items.ItemType  =  4 Then  
	   	  'Set default values in case of cost items  
	   	  var.whwmd400.locc  =  2 ' No  
	  End if  	   
	  var.whwmd400.locc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.locc, var.whwmd400.locc, Items.Exception, DefaultFound, 1)  
'  |   **********************************************************************************************   	   	   
'  |  In case of Lot Controlled  
'  |   **********************************************************************************************   	   
	  If Items.LotPrice  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.ltpr  =  2 ' No  
	  Else  
	   	  var.whwmd400.ltpr  =  Items.LotPrice  	   
	  End if  
	  if Items.LotControlled  =  1 then  
	   	  if Items.LotsInInventory  =  1 then  
	   	   	  'Lot controlled and in inventory  
	   	   	  var.whwmd400.lttr  =  1 'Yes  
	   	   	  var.whwmd400.linv  =  1 'Yes  
	   	   	  var.whwmd400.ledd  =  3 'Not applicable  
	   	   	  var.whwmd400.ledr  =  3 'Not applicable  
	   	   	  var.whwmd400.ledt  =  3 'Not applicable  
	   	   	  var.whwmd400.lisf  =  3 'Not applicable  
	   	   	  var.whwmd400.lism  =  3 'Not applicable  
	   	  else  
	   	   	  'Lot controlled not in inventory  
	   	   	  var.whwmd400.lttr  =  1 'Yes  
	   	   	  var.whwmd400.linv  =  2 'No  
	   	   	  var.whwmd400.ledd  =  1 'Yes  
	   	   	  var.whwmd400.ledr  =  2 'No  
	   	   	  var.whwmd400.ledt  =  2 'No  
	   	   	  var.whwmd400.lisf  =  2 'No  
	   	   	  var.whwmd400.lism  =  2 'No  
	   	  end if  
	   	   
	  else  
	   	  'Not lot controlled  
	   	  var.whwmd400.ltpr  =  2 'No  
	   	  var.whwmd400.lttr  =  2 'No  
	   	  var.whwmd400.linv  =  2 'No  
	   	  var.whwmd400.ledd  =  3 'Not applicable  
	   	  var.whwmd400.ledr  =  3 'Not applicable  
	   	  var.whwmd400.ledt  =  3 'Not applicable  
	   	  var.whwmd400.lisf  =  3 'Not applicable  
	   	  var.whwmd400.lism  =  3 'Not applicable  
	  end if  
	   
	  var.whwmd400.ltpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ltpr, var.whwmd400.ltpr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.lttr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lttr, var.whwmd400.lttr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.linv  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.linv, var.whwmd400.linv, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.ledd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledd, var.whwmd400.ledd, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.ledr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledr, var.whwmd400.ledr, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.ledt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledt, var.whwmd400.ledt, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.lisf  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lisf, var.whwmd400.lisf, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.lism  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lism, var.whwmd400.lism, Items.Exception, DefaultFound, 3)  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case Serialized  
'  |   **********************************************************************************************   	   
	  If Items.SerialPrice  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.srpr  =  2 ' No  
	  Else  
	   	  var.whwmd400.srpr  =  Items.SerialPrice  	   
	  End if  
	  if Items.Serialized  =  1 then  
	   	  if Items.SerialsInInventory  =  1 then  
	   	   	  'Serialized and in inventory  
	   	   	  var.whwmd400.srtr  =  1 'Yes  
	   	   	  var.whwmd400.sinv  =  1 'Yes  
	   	   	  var.whwmd400.sedd  =  3 'Not applicable  
	   	   	  var.whwmd400.sedr  =  3 'Not applicable  
	   	   	  var.whwmd400.sedt  =  3 'Not applicable  
	   	   	  var.whwmd400.sisf  =  3 'Not applicable  
	   	   	  var.whwmd400.sism  =  3 'Not applicable  
	   	  else  
	   	   	  'Serialized not in inventory  
	   	   	  var.whwmd400.srtr  =  1 'Yes  
	   	   	  var.whwmd400.sinv  =  2 'No  
	   	   	  var.whwmd400.sedd  =  1 'Yes  
	   	   	  var.whwmd400.sedr  =  2 'No  
	   	   	  var.whwmd400.sedt  =  2 'No  
	   	   	  var.whwmd400.sisf  =  2 'No  
	   	   	  var.whwmd400.sism  =  2 'No  
	   	  end if  
	  else  
	   	  ' Not serialized  
	   	  var.whwmd400.srpr  =  2 'No  
	   	  var.whwmd400.srtr  =  2 'No  
	   	  var.whwmd400.sinv  =  2 'No  
	   	  var.whwmd400.sedd  =  3 'Not applicable  
	   	  var.whwmd400.sedr  =  3 'Not applicable  
	   	  var.whwmd400.sedt  =  3 'Not applicable  
	   	  var.whwmd400.sisf  =  3 'Not applicable  
	   	  var.whwmd400.sism  =  3 'Not applicable  
	  end if  
	   
	  var.whwmd400.srpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.srpr, var.whwmd400.srpr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.srtr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.srtr, var.whwmd400.srtr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.sinv  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sinv, var.whwmd400.sinv, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.sedd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedd, var.whwmd400.sedd, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sedr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedr, var.whwmd400.sedr, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sedt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedt, var.whwmd400.sedt, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sisf  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sisf, var.whwmd400.sisf, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sism  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sism, var.whwmd400.sism, Items.Exception, DefaultFound, 3)  
	   	   	   	   	   	   	   	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item service Data (tsmdm200)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsService.*   
	  from  	  ItemDefaultsService  
	  where  	  ItemDefaultsService.kitm  =  varint.itemtype And ItemDefaultsService.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	   
	  'Defaults presents but not in Item access table  	   
	  var.tsmdm200.acos  =  ItemHandling.GetTypeEnum(ItemDefaultsService.acos, 0, Items.Exception, DefaultFound, 70)  
	  var.tsmdm200.cinc  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cinc, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tsmdm200.cmtc  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cmtc, 0, Items.Exception, DefaultFound, 20)  
	  var.tsmdm200.cmts  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cmts, 0, Items.Exception, DefaultFound, 20)  
	  var.tsmdm200.cvco  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cvco, 0, Items.Exception, DefaultFound, 15)  	   
	  var.tsmdm200.cpit  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cpit, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tsmdm200.dltp  =  ItemHandling.GetTypeEnum(ItemDefaultsService.dltp, 0, Items.Exception, DefaultFound, 4)  
	  var.tsmdm200.dtps  =  ItemHandling.GetTypeEnum(ItemDefaultsService.dtps, 0, Items.Exception, DefaultFound, 10)  
	  var.tsmdm200.owns  =  ItemHandling.GetTypeEnum(ItemDefaultsService.owns, 0, Items.Exception, DefaultFound, 10)  	  'LN10_4.n  
	  var.tsmdm200.rmcr  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rmcr, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rmsr  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rmsr, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rncw  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rncw, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rpyn  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rpyn, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rwun  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rwun, 0, Items.Exception, DefaultFound, 5)  
	  var.tsmdm200.scir  =  ItemHandling.GetTypeEnum(ItemDefaultsService.scir, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tsmdm200.sirq  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sirq, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.sswt  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sswt, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.sttp  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sttp, 0, Items.Exception, DefaultFound, 15)  	  'LN10_4.n  
	  var.tsmdm200.uval  =  ItemHandling.GetTypeEnum(ItemDefaultsService.uval, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.blag  =  ItemHandling.GetTypeString(ItemDefaultsService.blag, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ccds  =  ItemHandling.GetTypeString(ItemDefaultsService.ccds, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ccme  =  ItemHandling.GetTypeString(ItemDefaultsService.ccme, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ckgr  =  ItemHandling.GetTypeString(ItemDefaultsService.ckgr, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cmea  =  ItemHandling.GetTypeString(ItemDefaultsService.cmea, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cmpo  =  ItemHandling.GetTypeString(ItemDefaultsService.cmpo, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cogr  =  ItemHandling.GetTypeString(ItemDefaultsService.cogr, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cwte  =  ItemHandling.GetTypeString(ItemDefaultsService.cwte, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.gwte  =  ItemHandling.GetTypeString(ItemDefaultsService.gwte, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.peru  =  ItemHandling.GetTypeString(ItemDefaultsService.peru, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.prun  =  ItemHandling.GetTypeString(ItemDefaultsService.prun, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.sbct  =  ItemHandling.GetTypeString(ItemDefaultsService.sbct, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.scme  =  ItemHandling.GetTypeString(ItemDefaultsService.scme, "", Items.Exception, DefaultFound)  	   	  'LN10_4.n  
	  var.tsmdm200.smpo  =  ItemHandling.GetTypeString(ItemDefaultsService.smpo, "", Items.Exception, DefaultFound)  	   	  'LN10_4.n  
	  var.tsmdm200.swte  =  ItemHandling.GetTypeString(ItemDefaultsService.swte, "", Items.Exception, DefaultFound)  
	   
	  var.tsmdm200.mepo  =  ItemHandling.GetTypeNumber(ItemDefaultsService.mepo, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.nrpe  =  ItemHandling.GetTypeNumber(ItemDefaultsService.nrpe, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.rwdu  =  ItemHandling.GetTypeNumber(ItemDefaultsService.rwdu, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.srpd  =  ItemHandling.GetTypeNumber(ItemDefaultsService.srpd, 0, Items.Exception, DefaultFound)  
	   
	  'Defaults presents and present in Item access table  
	  var.tsmdm200.ccur  =  ItemHandling.GetTypeString(ItemDefaultsService.ccur, Items.ServiceCurrency, Items.Exception, DefaultFound)  
	  var.tsmdm200.cups  =  ItemHandling.GetTypeString(ItemDefaultsService.cups, Items.SalesUnit, Items.Exception, DefaultFound)  
	  var.tsmdm200.cuqs  =  ItemHandling.GetTypeString(ItemDefaultsService.cuqs, Items.SalesUnit, Items.Exception, DefaultFound)  
	  var.tsmdm200.cwoc  =  ItemHandling.GetTypeString(ItemDefaultsService.cwoc, Items.ServiceDepartment, Items.Exception, DefaultFound)  
	  var.tsmdm200.sigr  =  ItemHandling.GetTypeString(ItemDefaultsService.sigr, Items.SerializedItemGroup, Items.Exception, DefaultFound)  
	  var.tsmdm200.pris  =  ItemHandling.GetTypeNumber(ItemDefaultsService.pris, Items.ServicePrice, Items.Exception, DefaultFound)  
	   
'  |   **********************************************************************************************   	   	   
'  |   *  Setting variables for Item Service Data (tsmdm200)  
'  |   **********************************************************************************************   	   
	  If Items.ConfigurationControlled  <>  1 then  
	   	  var.tsmdm200.csgr  =  ItemHandling.GetTypeString(ItemDefaultsService.csgr, "", Items.Exception, DefaultFound)  
	  Else  
	   	  var.tsmdm200.csgr  =  ItemHandling.GetTypeString(ItemDefaultsService.csgr, Items.ServiceItemGroup, Items.Exception, DefaultFound)  
	  End if  
	   
	  If Items.ConfigurationControlled  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tsmdm200.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsService.seri, 0, Items.Exception, DefaultFound, 3)  	   
	  Else  
	   	  var.tsmdm200.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsService.seri, Items.ConfigurationControlled, Items.Exception, DefaultFound, 3)  	   
	  End If  
	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Project Data (tppdm005)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsProject.*   
	  from  	  ItemDefaultsProject  
	  where  	  ItemDefaultsProject.kitm  =  varint.itemtype And ItemDefaultsProject.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	   
	  'Defaults presents but not in Item access table  
	  var.tppdm005.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsProject.txta, 0, Items.Exception, DefaultFound)  
	  'Defaults presents and present in Item access table  	   
	  var.tppdm005.ccur  =  ItemHandling.GetTypeString(ItemDefaultsProject.ccur, Items.CostPriceCurrency, Items.Exception, DefaultFound)  
	   
	  If Items.ControlFunction  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.ccfu  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.ccfu, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.ccfu  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.ccfu, Items.ControlFunction, Items.Exception, DefaultFound, 1)  
	  End If  	   
	   	   
	  If Items.ProjectOrderSystem  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, 0, Items.Exception, DefaultFound, 9)  
	  Else  	   
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, Items.ProjectOrderSystem, Items.Exception, DefaultFound, 9)  
	  End If  
	   
	  If Item.PricePolicy  =  0 Then  
	   	  'Use default value if not specified  	   
	   	  var.tppdm005.cppp  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.cppp, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.cppp  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.cppp, Item.PricePolicy, Items.Exception, DefaultFound, 1)  
	  End if  	   	   
	   
	  If Items.ProjectOrderSystem  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, 0, Items.Exception, DefaultFound, 9)  
	  Else  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, Items.ProjectOrderSystem, Items.Exception, DefaultFound, 9)  
	  End if  	   
	   	   
	  If Items.RegisterProgress  =  0 Then  
	   	  'Use default value if not specified  	   
	   	  var.tppdm005.prre  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.prre, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.prre  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.prre, Items.RegisterProgress, Items.Exception, DefaultFound, 1)  	   
	  End If  
	   
	  var.tppdm005.ccit  =  get.segment.item.code(Items.CCItemProjectSegment, Items.CCItemItemSegment)  
	  var.tppdm005.ccit  =  ItemHandling.GetTypeString(ItemDefaultsProject.ccit, var.tppdm005.ccit, Items.Exception, DefaultFound)  	   
	   
	   
'  |   **********************************************************************************************   	   
'  |   *  Actual Dump Section  
'  |   **********************************************************************************************   	   
	  dump 001 '  |   *  Dump for tcibd001  
	  dump 400 '  |   *  Dump for whwmd400  
	   
	  if Items.ItemPurchaseData  <>  2 then  
	   	  dump 002 '  |   *  Dump for tdipu001  
	   	  dump 102 '  |   *  Dump for tdipu100  
	  end if  
	   
	  if Items.ItemSalesData  <>  2 then  
	   	  dump 003 '  |   *  Dump for tdisa001  
	  end if  
	   
	  if Items.ItemProductionData  <>  2 and _  
	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5) then  
	   	  dump 004 '  |   *  Dump for tiipd001  
	  end if  
	   
	  if Items.ItemType  <>  6 and Items.ItemType  <>  10 then  
	   	  dump 007 '  |   *  Dump for ticpr007  
	  end if  
	   
	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  10) then  
	   	  dump 100 '  |   *  Dump for tcibd100  
	  end if  
	   
	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5 or Items.ItemType  =  10) then  
	   	  cluster.found  =  0  
	   	  If varstr.cprj  =  "" or IsNUll(varstr.cprj) then  
	   	   	  select  	  ItemsByCluster.*   
	   	   	  from  	  ItemsByCluster  
	   	   	  where  	  (ItemsByCluster.Project  =  "" and ItemsByCluster.Item  =  varstr.item)  
	   	   	  selectdo  
	   	   	   	  cluster.found  =  1  
	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	   
	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	   
	   	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	   	  ' dump 120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
	   	   	  endselect  
	   	  Else  
	   	   	  select  	  ItemsByCluster.*   
	   	   	  from  	  ItemsByCluster  
	   	   	  where  	  (ItemsByCluster.Project  =  varstr.cprj and ItemsByCluster.Item  =  varstr.item)  
	   	   	  selectdo  
	   	   	   	  cluster.found  =  1  
	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	   
	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	   
	   	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	   	  'dump 120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
	   	   	  endselect  
	   	  End If  	   	   
	   	  if cluster.found  =  0 then  
	   	   	  varstr.clus  =  "   "  	   	   
	   	   	  var.planned.item  =  get.segment.cp.item.code(varstr.clus,varstr.cprj,varstr.item)  
	   	   	  var.cprpd100.cwar  =  Items.Warehouse  	   	   	   
	   	   	  var.cprpd100.sour  =  1  	   	   	   	   	   
	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	  ' dump 120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
	   	  end if  
	   	  dump 200 '  |   *  Dump for tcibd200  
	  end if  
	   
	  if Items.ItemServiceData  <>  2 and _  
	   	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  
	   	   	  dump 201 '  |   *  Dump for tsmdm200  
	  end if  
	  if Items.ItemProjectData  <>  2 then  
	   	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  	   
	   	   	  dump 005 '  |   *  Dump for tppdm005  
	   	  end if  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:S
:QURY:START
select  	   	  Items.*
from 	   	  Items
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:X
:QURY:START
'  |   **********************************************************************************************   	   
'  |  Restructured the script for the implementation of the item defaulting.  
'  |   	   
'  |  Cleaned Source for the below solutions and marking related to previous FP version  <  9  
'  |   -  243214  
'  |   -  244255  
'  |   -  244268  
'  |   -  244355  
'  |   -  249608  
'  |   **********************************************************************************************
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:D
:QURY:START
	  dump 64 '  |  PE to tcibd001  
	  dump 65 '  |  PE to tdipu001  
	  dump 66 '  |  PE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:S
:QURY:START
select ProjectEquipments.*
from ProjectEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:D
:QURY:START
	  if ProjectSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuti  
	  end if  
	  dump 74 '  |   *  PS to tcibd001  
	  dump 75 '  |   *  PS to tdipu001  
	  dump 76 '  |   *  PS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:S
:QURY:START
select ProjectSubcontractings.*
from ProjectSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:D
:QURY:START
	  if StandardEquipments.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 61 '  |   *  SE to tcibd001  
	  dump 62 '  |   *  SE to tdipu001  
	  dump 63 '  |   *  SE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:S
:QURY:START
select StandardEquipments.*
from StandardEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:D
:QURY:START
	  if StandardSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuti  
	  end if  
	  if StandardSubcontractings.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 71 '  |   *  SS to tcibd001  
	  dump 72 '  |   *  SS to tdipu001  
	  dump 73 '  |   *  SS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:S
:QURY:START
select StandardSubcontractings.*
from StandardSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:D
:QURY:START
	  var.tdipu010.scrp  =  ItemPurchaseBP.SourcingPercentage  
	  if (var.tdipu010.scrp  =  "0") then  
	   	  var.tdipu010.scrp  =  100  
	  end if  
	   
	  var.tdipu010.efdt  =  get.utc(ItemPurchaseBP.EffectiveDate,"yes")  
	  'var.tdipu010.exdt  =  get.utc(ItemPurchaseBP.ExpDate,"yes")  
	  If ItemPurchaseBP.ExpDate  =  "" or IsNull(ItemPurchaseBP.ExpDate) then  	   
	   	  var.tdipu010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tdipu010.exdt  =  get.utc(ItemPurchaseBP.ExpDate,"yes")  
	  end if  
	  varstr.cprj  =  ItemPurchaseBP.Project  
	  varstr.item  =  ItemPurchaseBP.Item  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select  	  Items.*   
	   	  from  	   	  Items  
	   	  where  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  else  
	   	  select Items.*   
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj AND Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  end if  
	  dump 010  	  '  |   #  tdipu010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:S
:QURY:START
select ItemPurchaseBP.*
from ItemPurchaseBP
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:D
:QURY:START
	  var.tdpcg030.efdt  =  get.utc(Matrices.EffectiveDate,"yes")  
	   
	   
	  dump 030 '  |  tdpcg030
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:S
:QURY:START
select Matrices.*
from Matrices
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:D
:QURY:START
	  var.tdpcg031.efdt  =  get.utc(PriceBooks.EffectiveDate,"yes")  
	  var.tdpcg031.exdt  =  get.utc(PriceBooks.ExpiryDate,"no")  	   
	  var.tdpcg031.endt  =  get.utc(PriceBooks.EntryDate,"yes")  	   
	   
	  dump 031 '  |  tdpcg031
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:S
:QURY:START
select PriceBooks.*
from PriceBooks
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tf
:TCMOD:gld
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionType
:ICOD:D
:QURY:START
	  dump 002  	  '  |  tfgld002
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tf
:TCMOD:gld
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionType
:ICOD:S
:QURY:START
select DimensionType.*
from DimensionType
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tf
:TCMOD:gld
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionType
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tf
:TCMOD:gld
:TFLNO:009
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionRangesbyLedgerAccount
:ICOD:D
:QURY:START
	  varstr.dcf  =  DimensionRangesbyLedgerAccount.DimensionFrom  
	  varstr.dct  =  DimensionRangesbyLedgerAccount.DimensionTo  
	  var.ledger.account  =  DimensionRangesbyLedgerAccount.LedgerAccount  
	  if Trim(varstr.source.gl.version)  =  "GLE" then  
	   	  varstr.dcf  =  Empty  
	   	  'KH.o varstr.dct  =  CDate("1/1/2038") '  |  2038 '  |  max(Date())  
	   	  varstr.dct  =  "ZZZZZZZZZ" 'KH.n  
	   	  var.ledger.account  =  get.ledger.account(DimensionRangesbyLedgerAccount.LedgerAccount)  
	  end if  
	  dump 009
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tf
:TCMOD:gld
:TFLNO:009
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionRangesbyLedgerAccount
:ICOD:S
:QURY:START
select DimensionRangesbyLedgerAccount.*
from DimensionRangesbyLedgerAccount
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tf
:TCMOD:gld
:TFLNO:009
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionRangesbyLedgerAccount
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:D
:QURY:START
	  dump 011
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:S
:QURY:START
select TransactionTypes.*
from TransactionTypes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tf
:TCMOD:gld
:TFLNO:051
:SCPAC:bc
:SCMOD:tbl
:SFLNO:CrossValidationRules
:ICOD:D
:QURY:START
	  if ((hold.validationrule  <>  CrossValidationRules.ValidationRule) or _  
	  (hold.version  <>  CrossValidationRules.Version)) then  
	   	  ' Dump validation Rule header record  
	   	  dump 051  	  '  |  For tfgld051  
	   	  hold.validationrule  =  CrossValidationRules.ValidationRule  
	   	  hold.version  =  CrossValidationRules.Version  
	  end if  
	   
	  'Dump validation rule lines (each record)  	   	   
	  dump 052  	  '  |  For tfgld052  
	
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tf
:TCMOD:gld
:TFLNO:051
:SCPAC:bc
:SCMOD:tbl
:SFLNO:CrossValidationRules
:ICOD:S
:QURY:START
select  	  CrossValidationRules.*
from 	  CrossValidationRules
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tf
:TCMOD:gld
:TFLNO:051
:SCPAC:bc
:SCMOD:tbl
:SFLNO:CrossValidationRules
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:D
:QURY:START
	  var.tibom010.indt  =  get.utc(BillOfMaterial.EffectiveDate,"yes")  
	  'var.tibom010.exdt  =  get.utc(BillOfMaterial.ExpiryDate,"no")  	   	   
	  If BillOfMaterial.ExpiryDate  =  "" or IsNull(BillOfMaterial.ExpiryDate) then  	   
	   	  var.tibom010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tibom010.exdt  =  get.utc(BillOfMaterial.ExpiryDate,"no")  
	  end if  
	  dump 010 '  |  tibom010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:S
:QURY:START
select BillOfMaterial.*
from BillOfMaterial
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:D
:QURY:START
	  if Projects.btco  =  1 then  
	   	  var.tppdm600.cmog  =  2  
	  else  
	   	  var.tppdm600.cmog  =  3  
	  end if  
	  if Projects.intp  =  1 then  
	   	  var.tppdm600.ipin  =  2  
	  else  
	   	  var.tppdm600.ipin  =  1  
	  end if  
	  var.tppdm600.rate  =  Projects.rate  
	  if trim(var.tppdm600.rate)  =  "" or IsNull(var.tppdm600.rate) then  
	   	  var.tppdm600.rate  =  1  
	  end if  
	  var.tppdm600.guid  =  "MIG_tppdm600_"  &  Projects.cprj  	   
	  dump 600 '  |   *  tppdm600  
	  dump 113 '  |   *  tcemm113  
	  dump 610 '  |   *  tcemm110 for tp
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:S
:QURY:START
select Projects.*
from Projects
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:D
:QURY:START
	  varstr.address  =  WorkCenter.Address  
	  select Addresses.City  
	  from  	  Addresses  
	  where Addresses.AddressCode  =  varstr.address  
	  selectdo  
	  endselect  
	   
	  var.tcmcs065.city  =  Left(Addresses.City, 8)  
	  dump 001 '  |   *  tirou001  
	  dump 065 '  |   *  tcmcs065  
	  dump 110 '  |   *  tcemm110  
	  dump 124 '  |   *  tcemm124  
	  dump 200 '  |   *  cprpd200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:S
:QURY:START
select WorkCenter.*
from WorkCenter
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:D
:QURY:START
'  |   *  ERP  -  00000  -  51389.sn  
	  var.cycletime  =  RoutingOperation.CycleTime  
	  varstr.cprj  =  RoutingOperation.ManufacturedProject  
	  varstr.item  =  RoutingOperation.ManufacturedItem  
	  varstr.routing  =  RoutingOperation.Routing  
	  var.quantity  =  0  
'  |   *  ERP  -  00000  -  51389.en  
	  If varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select RoutingCodesByItem.RoutingQuantity  
	   	  from  	  RoutingCodesByItem  
	   	  where RoutingCodesByItem.ManufacturedItem  =  varstr.item  
	   	  and  	  RoutingCodesByItem.Routing  =  varstr.routing  
	   	  selectdo  
	   	   	  If RoutingCodesByItem.ManufacturedProject  =  "" or IsNull(RoutingCodesByItem.ManufacturedProject) then  
	   	   	   	  var.quantity  =  RoutingCodesByItem.RoutingQuantity  
	   	   	  End If  
	   	  endselect  
	  else  
	   	  select RoutingCodesByItem.RoutingQuantity  
	   	  from  	  RoutingCodesByItem  
	   	  where RoutingCodesByItem.ManufacturedProject  =  varstr.cprj  
	   	  and  	  RoutingCodesByItem.ManufacturedItem  =  varstr.item  
	   	  and  	  RoutingCodesByItem.Routing  =  varstr.routing  
	   	  selectdo  
	   	   	  var.quantity  =  RoutingCodesByItem.RoutingQuantity  
	   	  endselect  
	  End If  
'  |   *  ERP  -  00000  -  51389.sn  
	  if var.cycletime  >  "0" then  
	   	  if var.quantity  =  "0" then  
'  |  243218.o  	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime) ,2)  
	   	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime) ,2,0,0,0) '  |  243218.n  
	   	  else  
'  |  243218.o  	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime)  *  Cdbl(var.quantity) ,2)  
	   	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime)  *  Cdbl(var.quantity) ,2,0,0,0) '  |  243218.n  
	   	  end if  
	  else  
	   	  var.tirou102.prte  =  0  
	  end if  
'  |   *  ERP  -  00000  -  51389.en  
	  var.tirou102.indt  =  get.utc(RoutingOperation.EffectiveDate,"yes")  
	  If RoutingOperation.ExpiryDate  =  "" or IsNull(RoutingOperation.ExpiryDate)then  	   
	   	  var.tirou102.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tirou102.exdt  =  get.utc(RoutingOperation.ExpiryDate,"yes")  
	  end if  	   
	  dump 102 '  |  tirou102
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:S
:QURY:START
select RoutingOperation.*
from RoutingOperation
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:D
:QURY:START
	  if CDbl(StandardEquipments.ratc)  >  0 then  
	   	  var.tppdm025.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardEquipments.rats)  >  0 then  
	   	  var.tppdm025.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrs  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardEquipments.ratp)  >  0 then  
	   	  var.tppdm025.ltrp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:S
:QURY:START
select StandardEquipments.*
from StandardEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardActivities
:ICOD:D
:QURY:START
	  var.prin  =  StandardActivities.prin  
	  '  |  Determine 'Progress for Invoice'  
	  var.cspt  =  StandardActivities.cspt  
	  if var.prin  =  3 then  	  '  |  Project Physical Progress  
	   	  var.cspt  =  2  	  '  |  Indirect  
	  end if  
	  if var.prin  =  4 then  	  '  |  Not Applicable  
	   	  var.cspt  =  3  	  '  |  Not Applicable  
	  end if  
	  '  |  Determine 'To Be Settled'  
	  var.setl  =  2  
	  if var.prin  =  1 then  
	   	  var.setl  =  StandardActivities.setl  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardActivities
:ICOD:S
:QURY:START
select StandardActivities.*
from StandardActivities
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardActivities
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:S
:QURY:START
select  	  StandardSurchargesGeneralAndByCostType.*
from 	  StandardSurchargesGeneralAndByCostType
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:171
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByCostComponent
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:171
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByCostComponent
:ICOD:S
:QURY:START
select StandardSurchargesByCostComponent.*
from StandardSurchargesByCostComponent
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:171
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByCostComponent
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:172
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByMaterial
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:172
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByMaterial
:ICOD:S
:QURY:START
select StandardSurchargesByMaterial.*
from StandardSurchargesByMaterial
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:172
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByMaterial
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:173
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByLabor
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:173
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByLabor
:ICOD:S
:QURY:START
select StandardSurchargesByLabor.*
from StandardSurchargesByLabor
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:173
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByLabor
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:174
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByEquipment
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:174
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByEquipment
:ICOD:S
:QURY:START
select StandardSurchargesByEquipment.*
from StandardSurchargesByEquipment
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:174
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesByEquipment
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:175
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySubcontracting
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:175
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySubcontracting
:ICOD:S
:QURY:START
select StandardSurchargesBySubcontracting.*
from StandardSurchargesBySubcontracting
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:175
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySubcontracting
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:176
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySundryCost
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:176
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySundryCost
:ICOD:S
:QURY:START
select StandardSurchargesBySundryCost.*
from StandardSurchargesBySundryCost
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:176
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesBySundryCost
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:D
:QURY:START
	  if CDbl(ProjectEquipments.ratc)  >  0 then  
	   	  var.tppdm625.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectEquipments.rats)  >  0 then  
	   	  var.tppdm625.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrs  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectEquipments.ratp)  >  0 then  
	   	  var.tppdm625.ltrp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrp  =  get.utc("","no")  
	  end if  
	  dump 01  	  '  |   *  tppdm625
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:S
:QURY:START
select ProjectEquipments.*
from ProjectEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:D
:QURY:START
	  varstr.project  =  Activities.cprj  
	  var.btco  =  1  	   	   	   	  '  |  Default is 'Element'  
	  var.invm  =  3  	   	   	  '  |  Default is 'Installment'  
	  var.secu  =  ""  
	  var.prss  =  0.0000  
	  var.rtse.1  =  0.000000  
	  var.rtse.2  =  0.000000  
	  var.rtse.3  =  0.000000  
	  var.rfse.1  =  0  
	  var.rfse.2  =  0  
	  var.rfse.3  =  0  
	  var.prin  =  4  	   	   	   
	  var.cspt  =  3  	   	   	   
	  var.setl  =  2  
	  var.gris  =  0  
	  select Projects.invm,  
	   	  Projects.btco  
	  from  	  Projects  
	  where Projects.cprj  =  varstr.project  
	  selectdo  
	   	  var.invm  =  Projects.invm  	  '  |  Invoice Type  
	   	  var.btco  =  Projects.btco  	  '  |  Control By  
	  endselect  
	  '  |  Check if 'Invoice Type'  =  Progress Invoice and 'Control By'  =  Activity  	   
	  if var.invm  =  4 and var.btco  =  2 then  	   	   
	   	  var.secu  =  Activities.secu  
	   	  var.prss  =  Activities.prss  
	   	  var.rtse.1  =  Activities.rtse  
	   	  var.rtse.2  =  0.000001  
	   	  var.rtse.3  =  0.000001  
	   	  var.rfse.1  =  Activities.rfse  
	   	  var.rfse.2  =  1  
	   	  var.rfse.3  =  1  
	   	  var.prin  =  Activities.prin  
	   	  '  |  Determine field 'Progress for Invoice'  
	   	  if var.prin  =  3 then  
	   	   	  var.cspt  =  2 '  |  Indirect  
	   	  end if  
	   	  '  |  Determine field 'To Be Settled'  
	   	  if var.prin  =  1 and var.cspt  =  1 then  
	   	   	  var.setl  =  Activities.setl  
	   	  end if  
	   	  if var.prin  =  2 and var.cspt  =  1 then  
	   	   	  var.setl  =  Activities.setl  
	   	  end if  
	   	  '  |  Determine field 'Group Indirect Work'  
	   	  if var.prin  =  1 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	   	  if var.prin  =  2 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	   	  if var.prin  =  3 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	  end if  
	  '  |  In case Actual Finish Date is filled the Actual Start Date must be empty  !   
	  var.asdt  =  Activities.asdt  
	  if trim(Activities.afdt)  <>  "" then  
	   	  var.asdt  =  ""  
	  end if  
	  dump 01  	  '  |   *  tppss200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:S
:QURY:START
select Activities.*
from Activities
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:S
:QURY:START
select Extensions.*
from Extensions
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:D
:QURY:START
	  var.prin  =  Elements.prin  
	  '  |  Condition for field 'Progress for Invoice'  
	  var.cspt  =  Elements.cspt  
	  if var.prin  =  2 then  	  '  |  No  
	   	  var.cspt  =  3  	  '  |  Not Applicable  
	  end if  
	  if var.prin  =  3 then  	  '  |  Project Physical Progress  
	   	  var.cspt  =  2  	  '  |  Indirect  
	  end if  
	  '  |  Condition for field 'To Be Settled'  
	  var.setl  =  2  
	  if var.prin  =  1 and var.cspt  =  1 then  
	   	  var.setl  =  Elements.setl  
	  end if  
	  dump 01  	  '  |   *  tpptc100
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:S
:QURY:START
select Elements.*
from Elements
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:D
:QURY:START
	  if Texts.TextID  <>  "NULL" then  
	   	  TextLength  =  len(Texts.Text )  
	   	  TextNumber  =  Texts.TextID  
	   	  TextSequence  =  1  
	   	  HEXcode  =  Right("00000000"  &  Hex(TextNumber), 8)  
	   	  for p  =  1 To 7 Step 2  
	   	   	  VarTextNumber  =  VarTextNumber  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	  next  
	   	  HEXcode  =  right ( "00000000"  &  HEX ( TextSequence ) , 8 )  
	   	  for p  =  1 to 7 Step 2  
	   	   	  VarTextSequence  =  VarTextSequence  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	  next  
	   	  i  =  1  
	   	  PrevPos  =  i  
	   	  NumOfCharacters  =  0  
	   	  Do while i  <=  TextLength  
	   	   	  '  |  TextBox needs to be split in multiple text lines  
	   	   	  TextCharacter  =  MID(Texts.Text ,i,1)  
	   	   	  if (NumOfCharacters  >=  240) then  
	   	   	   	  '  |  Create current text as a sequence line.  
	   	   	   	  TextString  =  TextString  +  EndTextString  
	   	   	   	  dump 1  	  '  |   **  TTTXT010  	   
	   	   	   	   
	   	   	   	  '  |  reset fields for next text sequence line.  
	   	   	   	  TextString  =  ""  	   	   	   
	   	   	   	  VarTextNumber  =  ""  	   	   	   
	   	   	   	  VarTextSequence  =  ""  	   	   
	   	   	   	  TextSequence  =  TextSequence  +  1  
	   	   	   	  PrevPos  =  i  
	   	   	   	  NumOfCharacters  =  0  
	   	   	   	   
	   	   	   	  HEXcode  =  Right("00000000"  &  Hex(TextNumber), 8)  
	   	   	   	  for p  =  1 To 7 Step 2  
	   	   	   	   	  VarTextNumber  =  VarTextNumber  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	   	   	  next  
	   	   	   	  HEXcode  =  right ( "00000000"  &  HEX ( TextSequence ) , 8 )  
	   	   	   	  for p  =  1 to 7 Step 2  
	   	   	   	   	  VarTextSequence  =  VarTextSequence  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	   	   	  next  
	   	   	  end if  
	   	   
	   	   	   
	   	   	  '  |  Check for Enter in text  
	   	   	  if (ASC (TextCharacter)  =  13) then  
	   	   	   	  TextCharacter  =  CHR(10)  	   	   	   
	   	   	   	  i  =  i  +  2  
	   	   	  else  
	   	   	   	  TextCharacter  =  TextCharacter  	   	   
	   	   	   	  i  =  i  +  1  
	   	   	  end if  
	   	   	  '  |  Check for TAB in text  
	   	   	  if (ASC (TextCharacter)  =  9) then  
	   	   	   	  CHRspace  =  CHR (32)  
	   	   	   	  TextCharacter  =  ""  	   	   	   	   	   	   	   
	   	   	   	  for p  =  1 to 6  	   	  '  |  Replace TAB with 6 spaces  	   	   	   	   
	   	   	   	   	  TextCharacter  =  TextCharacter  +  CHRspace  	   	   	   
	   	   	   	  next  	   
	   	   	   	  NumOfCharacters  =  NumOfCharacters  +  5  	   	   	   	   	   
	   	   	  end if  	   
	   	   	  TextString  =  TextString  +  TextCharacter  
	   	   	  NumOfCharacters  =  NumOfCharacters  +  1  
	   	  loop  
	   	   
	   	  '  |  Text line is maximum of 239 and fits in 1 text line  
	   	  TextString  =  TextString  +  CHR (10) '  |  Close Character of the string  
	   	   	   	   	   
	   	  '  |  Fill up the remainder of the string with spaces  
	   	  '  |  240  =  NumOfCharacters  +  Close chararter  +  NrOfSpaces  
	   	  NrOfSpaces  =  239  -  NumOfCharacters  	   	   	   	   
	   	  CHRspace  =  CHR ( 32 )  	   	   	   	   	   	   	   	   	   
	   	  for p  =  1 to NrOfSpaces  	   	   	   	   	   	   	   	   
	   	   	  TextString  =  TextString  +  CHRspace  	   	   	   	   
	   	  next  	   	   	   	   	   	   	   	   
	   	   	   	   	   	   	   	   
	   	  TextString  =  TextString  +  EndTextString  
	   	   
	   	  dump 1  	   	  '  |   **  TTTXT010  
	   	  TextString  =  ""  	   	   	   	   	   	   	   
	   	  VarTextNumber  =  ""  	   	   	   	   	   	   	   
	   	  VarTextSequence  =  ""  	   	   	   	   	   	   
	   	  dump 2  	   	  '  |   **  TTTXT002  
	   	  dump 3  	   	  '  |   **  TTTXT001  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:S
:QURY:START
select  	  Texts.*
from 	  Texts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:D
:QURY:START
	  var.whltc100.ldat  =  LotsByItem.LotDate  
	  if var.whltc100.ldat  =  "" or IsNull(var.whltc100.ldat) then  
	   	  var.whltc100.ldat  =  Date()  
	  end if  
	  dump 100 '  |  Lots
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:S
:QURY:START
select  	  LotsByItem.*
from 	  LotsByItem
order by LotsByItem.Project, LotsByItem.Item, LotsByItem.Lot
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:D
:QURY:START
	  varstr.cprj  =  WarehouseItem.Project  
	  varstr.item  =  WarehouseItem.Item  
	  var.whwmd210.ialt  =  20  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select Items.LocationControlled  
	   	  from Items  
	   	  where Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  If Items.Project  =  "" or IsNull(Items.Project) then  
	   	   	   	  If Items.LocationControlled  =  1 then  
	   	   	   	   	  var.whwmd210.ialt  =  5  
	   	   	   	  else  
	   	   	   	   	  var.whwmd210.ialt  =  20  
	   	   	   	  End If  
	   	   	  End If  
	   	  endselect  
	  else  
	   	  select Items.LocationControlled  
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj  
	   	  and  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  if Items.LocationControlled  =  1 then  
	   	   	   	  var.whwmd210.ialt  =  5  
	   	   	  else  
	   	   	   	  var.whwmd210.ialt  =  20  
	   	   	  end if  
	   	  endselect  
	  end if  
	   
	  if (WarehouseItem.OrderQuantityIncrement  <=  "0") then  
	   	  var.oqmf  =  1  
	  else  
	   	  var.oqmf  =  WarehouseItem.OrderQuantityIncrement  
	  end if  
	  if (WarehouseItem.MinimumOrderQuantity  <=  "0") then  
	   	  var.mioq  =  1  
	  else  
	   	  var.mioq  =  WarehouseItem.MinimumOrderQuantity  
	  end if  
	  if (WarehouseItem.MaximumOrderQuantity  <=  "0") then  
	   	  var.maoq  =  9999999  
	  else  
	   	  var.maoq  =  WarehouseItem.MaximumOrderQuantity  
	  end if  
	  if (WarehouseItem.FixedOrderQuantity  <=  "0") then  
	   	  var.fioq  =  1  
	  else  
	   	  var.fioq  =  WarehouseItem.FixedOrderQuantity  
	  end if  
'  	  if (Warehouse_Item.EconomicOrderQuantity  <=  "0") then  	   |   #  253844.so  
'  	   	  var.ecoq  =  1  
'  	  else  
'  	   	  var.ecoq  =  Warehouse_Item.EconomicOrderQuantity  
'  	  end if  	   	   	   	   	   	   	   |   #  253844.eo  
	  if (WarehouseItem.EconomicOrderQuantity  <=  "0") then  	  '  |   #  253844.sn  
	   	  var.ecoq  =  1  
	  else  
	   	  var.ecoq  =  WarehouseItem.EconomicOrderQuantity  
	  end if  
	   	   	   	   	   	   	  '  |   #  253844.en  
	  var.whwmd210.srpr  =  2  
	  if (WarehouseItem.InventoryValuationMethod)  =  6 then  
	   	  var.whwmd210.srpr  =  1  
	  end if  
	  dump 210  	  '  |   *  whwmd210  -  Warehouse Item Data  
	  dump 215  	  '  |   *  whwmd215  -  Item Inv by Warehouse  
	  dump 216  	  '  |   *  whwmd216  -  Inv by warehouse, item , eff unit
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:S
:QURY:START
select  	  WarehouseItem.*
from 	  WarehouseItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:wh
:TCMOD:wmd
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LocationCapacity
:ICOD:D
:QURY:START
	  dump 301
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:wh
:TCMOD:wmd
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LocationCapacity
:ICOD:S
:QURY:START
select LocationCapacity.*
from LocationCapacity
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:10
:VERS:A2LN
:RELE:LN
:CUST:10-4
:TCPAC:wh
:TCMOD:wmd
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LocationCapacity
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:D
:QURY:START
	  var.bpmdm001.sdte  =  get.date(EmployeesPeople.FirstDateEmployment,"yes")  
	  var.bpmdm001.edte  =  get.date(EmployeesPeople.LastDateEmployment,"no")  
	  var.bpmdm001.daob  =  get.date(EmployeesPeople.DateBirth,"no")  
	  dump 001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:S
:QURY:START
select EmployeesPeople.*
from EmployeesPeople
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:D
:QURY:START
	  var.cprpd710.effd  =  get.utc(SourcingStrategies.EffectivityDate, "yes")  
	  var.cprpd710.expd  =  get.utc(SourcingStrategies.ExpiryDate, "no")  	   
dump 710
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:S
:QURY:START
select SourcingStrategies.*
from SourcingStrategies
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:D
:QURY:START
	  varstr.bp  =  BusinessPartner.BusinessPartner  
	  CustomerRoles  =  0  
	  SupplierRoles  =  0  
	  if BusinessPartner.SearchKey  <>  "" then  
	   	  var.tccom100.seak  =  UCase(Left(BusinessPartner.SearchKey,16))  
	  else  
	   	  var.tccom100.seak  =  UCase(Left(BusinessPartner.Name,16))  
	  end if  
	  var.tccom100.stdt  =  get.utc(BusinessPartner.StartDate, "no")  
	  if BusinessPartner.SoldTo  =  1 then  
	   	  CustomerRoles  =  1  
	   	  dump 110 '  |   #  tccom110  
	  end if  
	  if BusinessPartner.ShipTo  =  1 then  
	   	  if Trim(BusinessPartner.ShipToAddress)  <>  "" then  
	   	   	  varstr.address  =  BusinessPartner.ShipToAddress  
	   	  else  
	   	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  end if  
	   	  CustomerRoles  =  1  
	   	  dump 111 '  |   #  tccom111  
	  end if  
	  if BusinessPartner.InvoiceTo  =  1 then  
	   	  if Trim(BusinessPartner.InvoiceToAddress)  <>  "" then  
	   	   	  varstr.address  =  BusinessPartner.InvoiceToAddress  
	   	  else  
	   	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  end if  
	   	  CustomerRoles  =  1  
	   	  var.tccom112.edci  =  get.utc(BusinessPartner.ExpiryDateInsuredCredit,"no")  
	   	  dump 112 '  |   #  tccom112  
	  end if  
	  if BusinessPartner.PayBy  =  1 then  
	   	  CustomerRoles  =  1  
'  |  243210.sn  
	   	  var.tccom114.cban  =  ""  
	   	  select BankAccountsByPayByBP.*   
	   	  from BankAccountsByPayByBP  
	   	  where BankAccountsByPayByBP.PayByBusinessPartner  =  varstr.bp  
	   	  order by BankAccountsByPayByBP.BankAccountCode desc  
	   	  selectdo  
	   	   	  var.tccom114.cban  =  BankAccountsByPayByBP.BankAccountCode  
	   	  endselect  
'  |  243210.en  
	   	  dump 114 '  |   #  tccom114  
	  end if  
	  if BusinessPartner.BuyFrom  =  1 then  
	   	  SupplierRoles  =  1  
	   	  dump 120 '  |   #  tccom120  
	  end if  
	  if BusinessPartner.ShipFrom  =  1 then  
	   	  SupplierRoles  =  1  
	   	  dump 121 '  |   #  tccom121  
	  end if  
	  if BusinessPartner.InvoiceFrom  =  1 then  
	   	  SupplierRoles  =  1  
'  |  FP7.sn  	   	   
	   	  var.tccom122.cadr  =  BusinessPartner.AddressCode  
	   	  var.tccom122.rtyp  =  BusinessPartner.ExchangeRateType  
	   	  var.tccom122.crlr  =  BusinessPartner.CreditLimit  
	   	  if Not IsNull(BusinessPartner.CreditLimit) then  
	   	   	  var.tccom122.crlr  =  BusinessPartner.CreditLimit  
	   	  else  
	   	   	  var.tccom122.crlr  =  0.0  
	   	  end if  	   	   	   
	   	  var.tccom122.cpay  =  BusinessPartner.TermsPayment  
	   	  var.tccom122.ccrs  =  BusinessPartner.LatePaymentSurcharge  
	   	  var.tccom122.paym  =  BusinessPartner.PaymentMethod  
	   	  varstr.businesspartner  =  BusinessPartner.BusinessPartner  
	   	  select BusinessPartnerExtension.*   
	   	  from BusinessPartnerExtension  
	   	  where BusinessPartnerExtension.BusinessPartner  =  varstr.businesspartner  
	   	  selectdo  
	   	   	  if BusinessPartnerExtension.AddressCodeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.cadr  =  BusinessPartnerExtension.AddressCodeInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.ExchangeRateTypeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.rtyp  =  BusinessPartnerExtension.ExchangeRateTypeInvFrom  
	   	   	  end if  	   	   
	   	   	  if Not IsNull(BusinessPartnerExtension.CreditLimitInvFrom) then  
	   	   	   	  var.tccom122.crlr  =  BusinessPartnerExtension.CreditLimitInvFrom  
	   	   	  end if  	   	   
	   	   	  if BusinessPartnerExtension.TermsPaymentInvFrom  <>  "" then  
	   	   	   	  var.tccom122.cpay  =  BusinessPartnerExtension.TermsPaymentInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.LatePaymentSurchargeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.ccrs  =  BusinessPartnerExtension.LatePaymentSurchargeInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.PaymentMethodInvFrom  <>  "" then  
	   	   	   	  var.tccom122.paym  =  BusinessPartnerExtension.PaymentMethodInvFrom  
	   	   	  end if  
	   	  endselect  
|  FP7.en  
	   	  dump 122 '  |   #  tccom122  
	  end if  
	  if BusinessPartner.PayTo  =  1 then  
	   	  SupplierRoles  =  1  
'  |   *  Determine Bank Code  
'  |   *   #  42.sn  
	   	  var.tccom124.cban  =  ""  
	   	  select BankAccountsByPayToBP.*   
	   	  from  	  BankAccountsByPayToBP  
	   	  where BankAccountsByPayToBP.PayToBusinessPartner  =  varstr.bp  
	   	  order by BankAccountsByPayToBP.BankAccountCode desc  
	   	  selectdo  
	   	   	  var.tccom124.cban  =  BankAccountsByPayToBP.BankAccountCode  
	   	  endselect  
'  |   *   #  42.en  
	   	  dump 124 '  |   #  tccom124  
	  end if  
	  if CustomerRoles  =  0 then  
	   	  if SupplierRoles  =  0 then  
	   	   	  var.tccom100.bprl  =  1  
	   	  else  
	   	   	  var.tccom100.bprl  =  3  
	   	  end if  
	  else  
	   	  if SupplierRoles  =  0 then  
	   	   	  var.tccom100.bprl  =  2  
	   	  else  
	   	   	  var.tccom100.bprl  =  4  
	   	  end if  
	  end if  
	  dump 100 '  |   #  tccom100  
	  If BusinessPartner.TaxNumber  <>  "" then  
	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  var.tctax400.ccty  =  ""  
	   	  select  	  Addresses.*   
	   	  from  	  Addresses  
	   	  where  	  Addresses.AddressCode  =  varstr.address  
	   	  selectdo  
	   	   	  var.tctax400.ccty  =  Addresses.Country  
	   	  endselect  
	   	  dump 400 '  |   #  tctax400  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:S
:QURY:START
select  	  BusinessPartner.*
from 	  BusinessPartner
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:D
:QURY:START
	  if Addresses.SearchKey  <>  "" then  
	   	  var.tccom130.seak  =  Ucase(Left(Addresses.SearchKey,16))  
	  else  
	   	  var.tccom130.seak  =  Ucase(Left(Addresses.Name,16))  
	  end if  
'  |  Determine default messaging method  
'  |  SITA not used  
	  var.tccom130.defa  =  10  
'target(tccom.defa.not.applicable)  
	  if Addresses.SMSNumber  <>  "" then  
	   	  var.tccom130.defa  =  5 'to.target(tccom.defa.sms)  
	  end if  
	  if Addresses.Telex  <>  "" then  
	   	  var.tccom130.defa  =  3 ' to.target(tccom.defa.telex)  
	  end if  
	  if Addresses.Fax  <>  "" then  
	   	  var.tccom130.defa  =  2' to.target(tccom.defa.fax)  
	  end if  
	  if Addresses.Email  <>  "" then  
	   	  var.tccom130.defa  =  1 ' to.target(tccom.defa.email)  
	  end if  
	  if len(trim(Addresses.Telephone))  >  0 then  
	   	  var.tccom130.defa  =  6 ' to.target(tccom.defa.phone)  
	  end if  
'  |  end determine defa  
	  If Addresses.GPSLatitude  <>  "" then  	   	   	   	   	   	  'LN1052.sn  
	   	  var.tccom130.glat  =  Addresses.GPSLatitude  
	  else  
	   	  var.tccom130.glat  =  0  
	  end if  	   	   	   	   	   	   	   	   	  'LN1052.en  
	  dump 130 '  |   #  tccom130  
'  
	  if len(trim(Addresses.ZipPostalCode))  >  0 then  
	   	  if var.country  <>  trim(Addresses.Country) or _  
	   	  var.zipcode  <>  trim(Addresses.ZipPostalCode) then  
	   	   	  var.country  =  trim(Addresses.Country)  
	   	   	  var.zipcode  =  trim(Addresses.ZipPostalCode)  
	   	   	  dump 136 '  |   #  tccom136  
	   	  end if  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:S
:QURY:START
select Addresses.*
from Addresses
order by Addresses.Country, Addresses.ZipPostalCode
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:D
:QURY:START
	  if trim(Contacts.SearchKey)  <>  "" then  
'  |   	   	  var.tccom140.seak  =  Ucase(Left(Contact.SearchKey,16)) '  |   *  249609.o  
	   	  var.tccom140.seak  =  Ucase(Left(Contacts.SearchKey,16)) '  |   *  249609.n  
	  else  
	   	  var.tccom140.seak  =  Ucase(Left(Contacts.FamilyName, 16))  
	  end if  
	   
	  var.tccom140.fuln  =  trim (Contacts.GivenName)  &  " "  &  trim(Contacts.MiddleName)  &  " "  &  trim(Contacts.FamilyName)  
	   
	  var.tccom140.bthd  =  get.date(Contacts.BirthDay,"no")  
	  var.tccom140.pelp  =  2  
	  var.tccom140.peld  =  2  
	  var.tccom140.pehm  =  2  
	  var.tccom140.pelm  =  2  
	  if trim (Contacts.Telephone)  <>  "" then  
	   	  var.tccom140.pelp  =  1 '  |  yes if Office phone filled  
	  else  
	   	  if trim (Contacts.Cellphone)  <>  "" then  
	   	   	  var.tccom140.pelm  =  1 '  |  yes If Mobile phone is filled  
	   	  else  
	   	   	  if trim (Contacts.PhonePrivate)  <>  "" then  
	   	   	   	  var.tccom140.pehm  =  1 '  |  yes If private phone is filled  
	   	   	  else  
	   	   	   	  if trim (Contacts.DirectDial)  <>  "" then  
	   	   	   	   	  var.tccom140.peld  =  1 '  |  yes If Direct Dial is filled  
	   	   	   	  end if  
	   	   	  end if  
	   	  end if  	   
	  end if  	   
	  dump 140  	  '  |   #  tccom140
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:S
:QURY:START
select Contacts.*
from Contacts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:D
:QURY:START
'  |   **********************************************************************************************   
'  |  Function Flow  
'  |  1  -  Setting of some global variables.  
'  |  2  -  For each dump table  
'  |   	   	  a  -  Handle defaulting fields not in the item access table  
'  |   	   	  b  -  Handle defaulting fields als in item access table  
'  |   	   	  c  -  All other variables for the dump table are set.  
'  |   	   	  Based upon specific values in the Item Access table a variable is set which is  
'  |   	   	  used in the dumps.  
'  |  3  -  Dump section for all tables.  
'  |   	   
'  |   **********************************************************************************************   
	  varstr.cprj  	   	   =  Items.Project  
	  varstr.item  	   	   =  Items.Item  
	  varstr.itemgroup  	   =  Items.ItemGroup  	   	   	   	   
	  varint.itemtype  	   =  Items.ItemType  
	  if Items.Exception  =  0 then  
	   	  Items.Exception  =  1  
	  end if  	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for General Data (tcibd001)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsGeneral.*   
	  from  	   	  ItemDefaultsGeneral  
	  where  	   	  ItemDefaultsGeneral.kitm  =  varint.itemtype And ItemDefaultsGeneral.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tcibd001.ccfg  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ccfg, "", Items.Exception, DefaultFound)  	  'LN10_4.n  
	  var.tcibd001.exin  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.exin, "", Items.Exception, DefaultFound)  
	   
	  var.tcibd001.chma  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.chma, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.cnfg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.cnfg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.dpcr  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpcr, 0, Items.Exception, DefaultFound, 100)  
	  var.tcibd001.dpeg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpeg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.dptp  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dptp, 0, Items.Exception, DefaultFound, 90)  
	  var.tcibd001.dpuu  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpuu, 0, Items.Exception, DefaultFound, 2)  	   	   
	  var.tcibd001.edco  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.edco, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.eitm  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.eitm, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.icsi  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.icsi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tcibd001.itmt  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.itmt, 0, Items.Exception, DefaultFound, 10)  
	  var.tcibd001.ippg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ippg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.mcoa  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.mcoa, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.ppeg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ppeg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.psiu  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.psiu, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.sayn  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.sayn, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.styp  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.styp, 0, Items.Exception, DefaultFound, 1)  
	  var.tcibd001.subc  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.subc, 0, Items.Exception, DefaultFound, 2)  
	   
	  'Defaults presents and present in Item access table  
	  var.tcibd001.ccde  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ccde, Items.CommodityCode, Items.Exception, DefaultFound)  
	  var.tcibd001.cean  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cean, Items.EANCode, Items.Exception, DefaultFound)  
	  var.tcibd001.cmnf  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cmnf, Items.Manufacturer, Items.Exception, DefaultFound)  
	  var.tcibd001.cood  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cood, Items.TechnicalCoordinator, Items.Exception, DefaultFound)  
	  var.tcibd001.cpcl  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpcl, Items.ProductClass, Items.Exception, DefaultFound)  
	  var.tcibd001.cpcp  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpcp, Items.CostComponent, Items.Exception, DefaultFound)  
	  var.tcibd001.cpln  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpln, Items.ProductLine, Items.Exception, DefaultFound)  
	  var.tcibd001.csel  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.csel, Items.SelectionCode, Items.Exception, DefaultFound)  
	  var.tcibd001.csig  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.csig, Items.ItemSignal, Items.Exception, DefaultFound)  
	  var.tcibd001.ctyo  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ctyo, Items.CountryOrigin, Items.Exception, DefaultFound)  
	  var.tcibd001.ctyp  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ctyp, Items.ProductType, Items.Exception, DefaultFound)  
	  var.tcibd001.cuni  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cuni, Items.InventoryUnit, Items.Exception, DefaultFound)  
	  var.tcibd001.dscb  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscb, Items.Material, Items.Exception, DefaultFound)  
	  var.tcibd001.dscc  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscc, Items.Size, Items.Exception, DefaultFound)  
	  var.tcibd001.dscd  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscd, Items.Standard, Items.Exception, DefaultFound)  
	  var.tcibd001.uset  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.uset, Items.UnitSet, Items.Exception, DefaultFound)  
	  var.tcibd001.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.txta, Items.TextIDGeneral, Items.Exception, DefaultFound)  
	  if Items.WeightUnit  =  "" then  
	   	  var.tcibd001.cwun  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cwun, var.weight.unit, Items.Exception, DefaultFound)  
	   	  var.tcibd001.wght  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.wght, 0, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd001.cwun  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cwun, Items.WeightUnit, Items.Exception, DefaultFound)  
	   	  var.tcibd001.wght  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.wght, Items.Weight, Items.Exception, DefaultFound)  
	  end if  
	  var.tcibd001.srce  =  DetermineSrce(Items.ItemType)  
	  var.tcibd001.srce  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.srce, var.tcibd001.srce, Items.Exception,DefaultFound, 10)  
'  |   **********************************************************************************************   
'  |  In case of Lot Controlled (tcibd001)  	   	   
'  |   **********************************************************************************************   
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tcibd001.ltct  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ltct, Items.LotControlled, Items.Exception, DefaultFound, 2)  
	  else  
	   	  var.tcibd001.ltct  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ltct, 2, Items.Exception, DefaultFound, 2)  
	  end if  
	   
'  |   **********************************************************************************************   
'  |  In case of Serialized Items (tcibd001)  
'  |   **********************************************************************************************   
	  If Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tcibd001.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.seri, Items.Serialized, Items.Exception, DefaultFound, 2)  	   
	  else  
	   	  var.tcibd001.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.seri, 2, Items.Exception, DefaultFound, 2)  	   	   
	  end if  
	   	   
'  |   **********************************************************************************************   
'  |  Settings for General Item data (tcibd001)  
'  |   **********************************************************************************************   
	  if Items.SearchKeyI  <>  "" then  
	   	  var.tcibd001.seak  =  UCase(Left(Items.SearchKeyI, 16))  
	  else  
	   	  var.tcibd001.seak  =  UCase(Left(Items.ItemDescription, 16))  
	  end if  
	   
	  if Items.SearchKeyII  <>  "" then  
	   	  var.tcibd001.seab  =  UCase(Left(Items.SearchKeyII, 16))  
	  else  
	   	  var.tcibd001.seab  =  UCase(Left(Items.Item, 16))  
	  end if  
	   
'  |   **********************************************************************************************   
'  |  Settings for Alternative Items (tcibd001)  
'  |   **********************************************************************************************   
	  var.tcibd001.repl  =  5  	   	   	   	   	   	  '  |  Not Applicable  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where ( AlternativeItems.Project  =  "" and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  10  	   	   	   	  '  |  Replaced  
	   	  endselect  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  "" and AlternativeItems.AlternativeItem  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  15  	   	   	   	  '  |  Substitute  
	   	  endselect  
	  else  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  varstr.cprj and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  10  	   	   	   	  '  |  Replaced  
	   	  endselect  
	  end if  
	   
	   
	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Costing Data (ticpr007)  
'  |   **********************************************************************************************   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsCosting.*   
	  from  	  ItemDefaultsCosting  
	  where  	  ItemDefaultsCosting.kitm  =  varint.itemtype And ItemDefaultsCosting.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.ticpr007.chrt  =  ItemHandling.GetTypeString(ItemDefaultsCosting.chrt, "", Items.Exception, DefaultFound)  	   
	  var.ticpr007.lcst  =  ItemHandling.GetTypeString(ItemDefaultsCosting.lcst, "", Items.Exception, DefaultFound)  
	  var.tcibd007.inlc  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.inlc, 0, Items.Exception, DefaultFound, 2)  
	   
	  'Defaults presents and present in Item access table  
	  var.tcibd007.acpm  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpm, Items.AggregatedMaterialCostCompo, Items.Exception, DefaultFound)  
	  var.tcibd007.ccur  =  ItemHandling.GetTypeString(ItemDefaultsCosting.ccur, Items.CostingCurrency, Items.Exception, DefaultFound)  
	  var.tcibd007.spit  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.spit, Items.SurchargesbyItem, Items.Exception, DefaultFound, 2)  
	  var.tcibd007.vpwh  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.vpwh, Items.SurchargesbyWarehouse, Items.Exception, DefaultFound, 2)  
	   
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tcibd007.acpo  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpo, Items.AggregatedOperationCostComp, Items.Exception, DefaultFound)  
	   	  var.tcibd007.acps  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acps, Items.AggregatedSurchargeCostComp, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd007.acpo  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpo, "", Items.Exception, DefaultFound)  
	   	  var.tcibd007.acps  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acps, "", Items.Exception, DefaultFound)  
	  end if  
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Purchase Data (tdipu001)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsPurchase.*   
	  from  	  ItemDefaultsPurchase  
	  where  	  ItemDefaultsPurchase.kitm  =  varint.itemtype And ItemDefaultsPurchase.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  	   
	   
	  'Defaults presents but not in Item access table  	   
	  var.tdipu001.cncd  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cncd, "", Items.Exception, DefaultFound)  	  'LN10_4.n  
	   
	  var.tdipu001.rtdm  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtdm, 0, Items.Exception, DefaultFound)  
	  var.tdipu001.rtdp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtdp, 0, Items.Exception, DefaultFound)  	   
	  var.tdipu001.rtqm  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtqm, 0, Items.Exception, DefaultFound)  
	  var.tdipu001.rtqp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtqp, 0, Items.Exception, DefaultFound)  
	   
	  var.tdipu001.acci  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.acci, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.casl  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.casl, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.cims  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.cims, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.hstq  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.hstq, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.hstd  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.hstd, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.issp  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.issp, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.mmnf  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.mmnf, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.mpyn  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.mpyn, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tdipu001.rqms  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.rqms, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.rmss  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.rmss, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tdipu001.qual  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.qual, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.vryn  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.vryn, 0, Items.Exception, DefaultFound, 1)  
	   
	  'Defaults presents and present in Item access table  
	  var.tdipu001.buyr  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.buyr, Items.Buyer, Items.Exception, DefaultFound)  
	  var.tdipu001.ccur  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.ccur, Items.PurchaseCurrency, Items.Exception, DefaultFound)  
	  var.tdipu001.cofc  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cofc, Items.PurchaseOffice, Items.Exception, DefaultFound)  
	  var.tdipu001.cpgp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cpgp, Items.PurchasePriceGroup, Items.Exception, DefaultFound)  
	  var.tdipu001.csgp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.csgp, Items.PurchaseStatisticsGroup, Items.Exception, DefaultFound)  
	  var.tdipu001.cupp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cupp, Items.PurchasePriceUnit, Items.Exception, DefaultFound)  
	  var.tdipu001.cuqp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cuqp, Items.PurchaseUnit, Items.Exception, DefaultFound)  
	  var.tdipu001.cvat  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cvat, Items.TaxCodePurchase, Items.Exception, DefaultFound)  
	  var.tdipu001.otbp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.otbp, Items.BuyFromBusinessPartner, Items.Exception, DefaultFound)  
	  var.tdipu001.txtp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.txtp, Items.TextIDPurchase, Items.Exception, DefaultFound)  
	   
	  If Items.ItemType  =  4 then  
	   	  var.tdipu001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.retw, 2, Items.Exception, DefaultFound, 1)  
	   	  var.tdipu001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cwar, "", Items.Exception, DefaultFound)  
	  else  
	   	  var.tdipu001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.retw, 1, Items.Exception, DefaultFound, 1)  
	   	  var.tdipu001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cwar, Items.Warehouse, Items.Exception, DefaultFound)  
	  end if  
	   
	  If Items.SupplyTime  <  "0" then  
	   	  'Set value to zero in case it is smaller than zero  
	   	  var.tdipu001.suti  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.suti, 0, Items.Exception, DefaultFound)  	   
	  else  	   
	   	  var.tdipu001.suti  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.suti, Items.SupplyTime, Items.Exception, DefaultFound)  	   
	  end if  
	   
	  If Items.UnitforSupplyTime  =  "" then  
	   	  ' Set access value to 10 in case it is empty  
	   	  var.tdipu001.sutu  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sutu, 10, Items.Exception, DefaultFound, 10)  
	  Else  
	   	  var.tdipu001.sutu  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sutu, Items.UnitforSupplyTime, Items.Exception, DefaultFound, 10)  	   
	  End If  
	  var.tdipu001.sopr  =  set.source.of.price(Items.ItemType)  	  '  |  Fp9.n  
	  var.tdipu001.sopr  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sopr, var.tdipu001.sopr, Items.Exception, DefaultFound, 3)  
	   	   	   	   	   	   	   	   	   	   	  'LN10_4.sn  
	  var.tdipu001.sops  =  set.source.of.price.for.service.subcontracting(Items.ItemType)  
	  var.tdipu001.sops  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sopr, var.tdipu001.sops, Items.Exception, DefaultFound, 3)  
	   
	  var.tdipu001.prip  =  get.purchase.price(Items.ItemType, Items.PurchasePrice)  
	   	   	   	   	   	   	   	   	   	   	  'LN10_4.en  
	   
	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Sales Data (tdisa001)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsSales.*   
	  from  	  ItemDefaultsSales  
	  where  	  ItemDefaultsSales.kitm  =  varint.itemtype And ItemDefaultsSales.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tdisa001.lmsp  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.lmsp, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.mnra  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.mnra, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.mmtl  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.mmtl, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.qidd  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qidd, 9999999.99, Items.Exception, DefaultFound)  
	  var.tdisa001.qimc  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qimc, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.qimo  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qimo, 1, Items.Exception, DefaultFound)  
	  var.tdisa001.umsp  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.umsp, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.cmgp  =  ItemHandling.GetTypeString(ItemDefaultsSales.cmgp, "", Items.Exception, DefaultFound)  
	  var.tdisa001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsSales.cwar, "", Items.Exception, DefaultFound)  
	  var.tdisa001.rbgp  =  ItemHandling.GetTypeString(ItemDefaultsSales.rbgp, "", Items.Exception, DefaultFound)  
	   
	  var.tdisa001.acci  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.acci, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.acom  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.acom, 0, Items.Exception, DefaultFound, 1)  
	  var.tdisa001.actn  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.actn, 0, Items.Exception, DefaultFound, 3)  
	  var.tdisa001.alod  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.alod, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.cphl  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.chpl, 0, Items.Exception, DefaultFound, 5)  	   
	  var.tdisa001.rcom  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.rcom, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.scon  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.scon, 0, Items.Exception, DefaultFound, 10)  
	  var.tdisa001.tltp  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.tltp, 0, Items.Exception, DefaultFound, 3)  
	  'Defaults presents and present in Item access table  
	  var.tdisa001.cpgs  =  ItemHandling.GetTypeString(ItemDefaultsSales.cpgs, Items.SalesPriceGroup, Items.Exception, DefaultFound)  
	  var.tdisa001.csgs  =  ItemHandling.GetTypeString(ItemDefaultsSales.csgs, Items.SalesStatisticsGroup, Items.Exception, DefaultFound)  
	  var.tdisa001.cups  =  ItemHandling.GetTypeString(ItemDefaultsSales.cups, Items.SalesPriceUnit, Items.Exception, DefaultFound)  
	  var.tdisa001.cuqs  =  ItemHandling.GetTypeString(ItemDefaultsSales.cuqs, Items.SalesUnit, Items.Exception, DefaultFound)  	   
	  var.tdisa001.cvat  =  ItemHandling.GetTypeString(ItemDefaultsSales.cvat, Items.TaxCodeSales, Items.Exception, DefaultFound)  
	  var.tdisa001.txts  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.txts, Items.TextIDSales, Items.Exception, DefaultFound)  
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tdisa001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.retw, 1, Items.Exception, DefaultFound, 2)  
	  else  
	   	  var.tdisa001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.retw, 2, Items.Exception, DefaultFound, 2)  
	  end if  
	   
'  |   **********************************************************************************************   	   
'  |   *  Setting variables for Item Sales Data (tdisa001)  
'  |   **********************************************************************************************   	   
	  if Items.SalesPrice  <  "0" Then  
	   	  ' minimum price is 0  
	   	  var.tdisa001.pris  =  0  
	  Else  
	   	  var.tdisa001.pris  =  Items.SalesPrice  
	  end if  
	   
	  if Items.SuggestedRetailPrice  <  "0" then  
	   	  ' minimum price is 0  
	   	  var.tdisa001.prir  =  0  
	  Else  
	   	  var.tdisa001.prir  =  Items.SuggestedRetailPrice  
	  end if  
	   
'  |   ********************************************************************************************   
'  |  It default variables for Item Ordering Data (tcibd200)  
'  |   ********************************************************************************************   
	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsOrdering.*   
	  from  	  ItemDefaultsOrdering  
	  where  	  ItemDefaultsOrdering.kitm  =  varint.itemtype And ItemDefaultsOrdering.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tcibd200.auso  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.auso, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.crmp  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.crmp, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.kctr  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.kctr, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.plpl  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.plpl, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tcibd200.ptyp  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.ptyp, 0, Items.Exception, DefaultFound, 3)  	   
	  var.tcibd200.uaoq  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.uaoq, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.wpcs  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.wpcs, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	   
	  var.tcibd200.nopr  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.nopr, 1, Items.Exception, DefaultFound)  
	  var.tcibd200.ocst  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ocst, 0, Items.Exception, DefaultFound)  
	  var.tcibd200.serv  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.serv, 0, Items.Exception, DefaultFound)  
	  var.tcibd200.csps  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.csps, "", Items.Exception, DefaultFound)  
	  var.tcibd200.cspd  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cspd, "", Items.Exception, DefaultFound)  
	  var.tcibd200.cplb  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cplb, "", Items.Exception, DefaultFound)  
	  var.tcibd200.rgrp  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.rgrp, "", Items.Exception, DefaultFound)  
	  var.tcibd200.sfpl  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.sfpl, "", Items.Exception, DefaultFound)  
	  'Defaults presents and present in Item access table  
	  var.tcibd200.cwar  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cwar, Items.Warehouse, Items.Exception, DefaultFound)  	   
	  var.tcibd200.maxs  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maxs, Items.MaximumInventory, Items.Exception, DefaultFound)  	   
	  var.tcibd200.oint  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oint, Items.OrderInterval, Items.Exception, DefaultFound)  
	  var.tcibd200.reop  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.reop, Items.Reorderpoint, Items.Exception, DefaultFound)  
	  var.tcibd200.sftm  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.sftm, Items.SafetyTime, Items.Exception, DefaultFound)  
	  var.tcibd200.sfst  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.sfst, Items.SafetyStock, Items.Exception, DefaultFound)  
	  var.tcibd200.oivu  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.oivu, Items.OrderIntervalUnit, Items.Exception, DefaultFound, 10)  
	  var.tcibd200.omth  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.omth, Items.OrderMethod, Items.Exception, DefaultFound, 1)  
	  var.tcibd200.opol  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.opol, Items.OrderPolicy, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.tuni  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.tuni, Items.SafetyTimeUnit, Items.Exception, DefaultFound, 10)  
	   
	  If Items.OrderSystem  =  4 and Items.ItemType  <>  3 then  
	   	  var.tcibd200.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.osys, 9, Items.Exception, DefaultFound, 9)  
	  else  
	   	  var.tcibd200.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.osys, Items.OrderSystem, Items.Exception, DefaultFound, 9)  
	  end if  
	  if (Items.OrderQuantityIncrement  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.oqmf  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oqmf, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.oqmf  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oqmf, Items.OrderQuantityIncrement, Items.Exception, DefaultFound)  
	  end if  	   
	  if (Items.MinimumOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.mioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.mioq, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.mioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.mioq, Items.MinimumOrderQuantity, Items.Exception, DefaultFound)  
	  end if  
	  if (Items.MaximumOrderQuantity  <=  "0") then  
	   	  var.tcibd200.maoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maoq, 9999999, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tcibd200.maoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maoq, Items.MaximumOrderQuantity, Items.Exception, DefaultFound)  	   	   
	  End if  
	  If (Items.FixedOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.fioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.fioq, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.fioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.fioq, Items.FixedOrderQuantity , Items.Exception, DefaultFound)  	   	   
	  end if  
	   
	  If (Items.EconomicOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.ecoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ecoq, 1, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tcibd200.ecoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ecoq, Items.EconomicOrderQuantity, Items.Exception, DefaultFound)  
	  End if  
'  |   **********************************************************************************************   
'  |  Item default variables for Item Production Data (tiipd001)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsProduction.*   
	  from  	  ItemDefaultsProduction  
	  where  	  ItemDefaultsProduction.kitm  =  varint.itemtype And ItemDefaultsProduction.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tiipd001.pcrp  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.pcrp, 0, Items.Exception, DefaultFound)  
	  var.tiipd001.scdl  =  ItemHandling.GetTypeString(ItemDefaultsProduction.scdl, "", Items.Exception, DefaultFound)  
	  var.tiipd001.cick  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.cick, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.drin  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.drin, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.dris  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.dris, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.iuma  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.iuma, 0, Items.Exception, DefaultFound, 10)  
	  var.tiipd001.oqdr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oqdr, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.repi  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.repi, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.smfs  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.smfs, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tiipd001.swoc  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.swoc, 0, Items.Exception, DefaultFound, 1)  	   
	   
	  'Defaults presents and present in Item access table  
	  var.tiipd001.cpha  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.cpha, Items.Phantom, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.phst  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.phst, Items.UsePhantomInventory, Items.Exception, DefaultFound, 2)  
	  If Items.BackflushIfMaterial  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfcp  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfcp,2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfcp  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfcp,Items.BackflushIfMaterial, Items.Exception, DefaultFound, 2)  
	  End If  
	  If Items.BackflushMaterials  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfep  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfep,2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfep  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfep,Items.BackflushMaterials, Items.Exception, DefaultFound, 2)  
	  End If  
	  If Items.BackflushHours  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfhr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfhr, 2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfhr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfhr,Items.BackflushHours, Items.Exception, DefaultFound, 2)  
	  End if  
	   	   	   
	  If Items.RoutingQuantity  <=  "0" Then  
	   	  'Minimum value is 1  
	   	  var.tiipd001.runi  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.runi, 1, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.runi  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.runi, Items.RoutingQuantity, Items.Exception, DefaultFound)  	   
	  End if  
	  If Items.BOMQuantity  <=  "0" then  
	   	  'Minimum value is 1  
	   	  var.tiipd001.unom  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.unom, 1, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.tiipd001.unom  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.unom, Items.BOMQuantity, Items.Exception, DefaultFound)  	   	   
	  End if  
	  If Items.ScrapFactor  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.scpf  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpf, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.scpf  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpf, Items.ScrapFactor, Items.Exception, DefaultFound)  
	  End if  
	  If Items.ScrapQuantity  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.scpq  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpq, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.scpq  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpq, Items.ScrapQuantity, Items.Exception, DefaultFound)  
	  End if  
	  If Items.OrderLeadTimeUnit  =  0 Then  
	   	  'If not defined than it will be mapped with hours (5)  
	   	  var.tiipd001.oltu  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oltu, 5 , Items.Exception, DefaultFound, 5)  
	  Else  
	   	  var.tiipd001.oltu  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oltu,Items.OrderLeadTimeUnit, Items.Exception, DefaultFound, 5)  
	  End if  
	  If Items.OrderLeadTime  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.oltm  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.oltm, 0, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.tiipd001.oltm  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.oltm, Items.OrderLeadTime, Items.Exception, DefaultFound)  
	  End if  	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Planning Data (cprpd100)  
'  |   **********************************************************************************************   	   
	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	   	  ItemDefaultsPlanning.*   
	  from  	   	  ItemDefaultsPlanning  
	  where  	   	  ItemDefaultsPlanning.kitm  =  varint.itemtype And ItemDefaultsPlanning.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.cprpd100.fite  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.fite, "", Items.Exception, DefaultFound)  
	  var.cprpd100.fide  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.fide, "", Items.Exception, DefaultFound)  
	  var.cprpd100.mrpu  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.mrpu, "", Items.Exception, DefaultFound)  
	  var.cprpd100.rpun  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.rpun, "", Items.Exception, DefaultFound)  
	  '  
	  var.cprpd100.audf  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.audf, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.auiv  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.auiv, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.aupr  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.aupr, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.aupu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.aupu, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.catp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.catp, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.chat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.chat, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.coat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.coat, 0, Items.Exception, DefaultFound, 2)  	   
	  var.cprpd100.cria  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.cria, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.depd  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.depd, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.deps  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.deps, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.efpg  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.efpg, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.fatp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.fatp, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.fica  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.fica, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.info  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.info, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.mult  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.mult, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.onat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.onat, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.pbpl  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.pbpl, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.prio  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.prio, 0, Items.Exception, DefaultFound, 5)  
	  var.cprpd100.uatt  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.uatt, 0, Items.Exception, DefaultFound, 5)  
	  var.cprpd100.upho  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.upho, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.utmf  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.utmf, 0, Items.Exception, DefaultFound, 1)  
	  '  
	  var.cprpd100.atho  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.atho, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.atta  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.atta, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.attm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.attm, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.fasi  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fasi, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.fltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fltm, 9999, Items.Exception, DefaultFound)  
	  var.cprpd100.hoat  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.hoat, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.inho  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.inho, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.retf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.retf, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.tfat  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tfat, 0, Items.Exception, DefaultFound)  
	  '  
	  'Defaults presents and present in Item access table  
	  var.cprpd100.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.osys,Items.MaintainMasterPlan, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.plvl  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.plvl, Items.PlanLevel, Items.Exception, DefaultFound)  
	  var.cprpd100.plid  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.plid, Items.Planner, Items.Exception, DefaultFound)  
	  If Items.ExtraLeadTime  <  "0" then  
	   	  ' Mimimum value is 0  
	   	  var.cprpd100.eltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.eltm, 0, Items.Exception, DefaultFound)  
	  Else  	   
	   	  var.cprpd100.eltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.eltm, Items.ExtraLeadTime, Items.Exception, DefaultFound)  
	  End if  
	  If Items.ForecastTimeFence  <  "0" then  
	   	  ' Mimimum value is 0  
	   	  var.cprpd100.fctf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fctf, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.cprpd100.fctf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fctf, Items.ForecastTimeFence, Items.Exception, DefaultFound)  	   
	  End if  
	  If Items.TimeFence  <  "0" then  
	   	  ' Mimimum value is 0  
	   	  var.cprpd100.tmfc  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tmfc, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.cprpd100.tmfc  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tmfc, Items.TimeFence, Items.Exception, DefaultFound)  
	  End if  
	  If Items.UnitForExtraLeadTime  =  0 Then  
	   	  'If not defined than it will be mapped with days (10)  
	   	  var.cprpd100.eltu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.eltu,10, Items.Exception, DefaultFound, 10)  
	  Else  	   
	   	  var.cprpd100.eltu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.eltu,Items.UnitForExtraLeadTime, Items.Exception, DefaultFound, 10)  
	  End if  
	  If Items.TimeFenceUnit  =  0 then  
	   	  'If not defined than it will be mapped with days (10)  
	   	  var.cprpd100.tmfu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.tmfu,10, Items.Exception, DefaultFound, 10)  
	  Else  
	   	  var.cprpd100.tmfu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.tmfu,Items.TimeFenceUnit, Items.Exception, DefaultFound, 10)  
	  End if  
	  If Items.OrderHorizon  <=  "0" then  
	   	  If Items.MaintainMasterPlan  =  2 then  
	   	   	  'If Items.OrderHorizon is not specified it will be defaulted based upon MaintainMastesPlan.  
	   	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, 180, Items.Exception, DefaultFound)  
	   	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, 180, Items.Exception, DefaultFound)  
	   	  Else  
	   	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, 360, Items.Exception, DefaultFound)  
	   	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, 180, Items.Exception, DefaultFound)  
	   	  End if  	   	   	   
	  Else  
	   	  If Items.MaintainMasterPlan  =  2 then  
	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  
	   	  Else  
	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  *  2  
	   	  End If  
	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, Items.OrderHorizon, Items.Exception, DefaultFound)  	   	   
	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, var.cprpd100.ptmf, Items.Exception, DefaultFound)  
	  End if  
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Warehousing Data (whwmd400)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false '  
	  select  	  ItemDefaultsWarehousing.*   
	  from  	  ItemDefaultsWarehousing  
	  where  	  ItemDefaultsWarehousing.kitm  =  varint.itemtype And ItemDefaultsWarehousing.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true '  
	  endselect  
	   	   
	  'Defaults presents but not in Item access table '  
	  var.whwmd400.cfmd  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.cfmd, "", Items.Exception, DefaultFound)  
	  var.whwmd400.pkdf  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.pkdf, "", Items.Exception, DefaultFound)  	   
	  var.whwmd400.rgtm  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.rgtm, "", Items.Exception, DefaultFound)  
	  var.whwmd400.risk  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.risk, "", Items.Exception, DefaultFound)  	   
	  var.whwmd400.ffsi  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.ffsi, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.npsl  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.npsl, 0, Items.Exception, DefaultFound)  	   
	  var.whwmd400.potc  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.potc, 0, Items.Exception, DefaultFound)  	   
	  var.whwmd400.qcma  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.qcma, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.qcmi  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.qcmi, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.txta, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.ddlt  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.ddlt, 0, Items.Exception, DefaultFound) 'LN10_4.n'  
	  var.whwmd400.alle  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.alle, 0, Items.Exception, DefaultFound, 1)  
	  var.whwmd400.askp  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.askp, 0, Items.Exception, DefaultFound, 1)  	   
	  var.whwmd400.assi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.assi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ccma  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ccma, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.coas  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.coas, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.cspr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.cspr, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ctzi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ctzi, 0, Items.Exception, DefaultFound, 5)  	   
	  var.whwmd400.dmsi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmsp  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsp, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmsr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsr, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmss  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmss, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dwhs  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dwhs, 0, Items.Exception, DefaultFound, 70)  	   
	  var.whwmd400.dycd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dycd, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.excc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.excc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.hama  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.hama, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.kpsl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.kpsl, 0, Items.Exception, DefaultFound, 4)  	   
	  var.whwmd400.lveh  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lveh, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.mabc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.mabc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.niwo  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.niwo, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.owip  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owip, 0, Items.Exception, DefaultFound, 20)  	   
	  var.whwmd400.owrl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owrl, 0, Items.Exception, DefaultFound, 10)  	   
	  var.whwmd400.owrt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owrt, 0, Items.Exception, DefaultFound, 10)  	   
	  var.whwmd400.prva  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.prva, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.spri  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.spri, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.thus  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.thus, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ufpl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ufpl, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.uhnd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.uhnd, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.vers  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.vers, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.wmsc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.wmsc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.rjha  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.rjha, 0, Items.Exception, DefaultFound, 10)  	  'LN10_4.sn '  
	  var.whwmd400.tmun  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.tmun, 0, Items.Exception, DefaultFound, 10)  
	  var.whwmd400.uidt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.uidt, 0, Items.Exception, DefaultFound, 10)  	  'LN10_4.en '  
	   
	  'Defaults presents and present in Item access table'  
	  var.whwmd400.usab  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.usab, Items.ExpectedAnnualIssue, Items.Exception, DefaultFound)  
	  var.whwmd400.ivgr  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.ivgr, Items.ItemValuationGroup, Items.Exception, DefaultFound)  
	   
	  var.whwmd400.abcc  =  Ucase(Left(Items.Abcc, 1))  
	  var.whwmd400.abcc  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.abcc, var.whwmd400.abcc, Items.Exception, DefaultFound)  
	  if Items.FloorStock  =  0 Then  
	   	  'Use default value if not specified '  
	   	  var.whwmd400.pics  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.pics, 2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.whwmd400.pics  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.pics, Items.FloorStock, Items.Exception, DefaultFound, 2)  
	  end if  
	  if Items.InventoryCarryingCosts  <  "0" Then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.scst  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.scst, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.whwmd400.scst  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.scst, Items.InventoryCarryingCosts, Items.Exception, DefaultFound)  	   	   	   	   
	  End if  
	   
	  if Items.Height  <  "0" Then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.hght  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.hght, 0, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.whwmd400.hght  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.hght, Items.Height, Items.Exception, DefaultFound)  
	  end if  
	  if Items.Width  <  "0" Then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.wdth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.wdth, 0, Items.Exception, DefaultFound)  	   
	  Else  
	   	  var.whwmd400.wdth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.wdth, Items.Width, Items.Exception, DefaultFound)  
	  end if  
	  if Items.Depth  <  "0" then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.dpth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.dpth, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.whwmd400.dpth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.dpth, Items.Depth, Items.Exception, DefaultFound)  	   	   
	  end if  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case of Outbound Method  
'  |   **********************************************************************************************   
	  if Items.OutboundMethod  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.obpr  =  2 ' FIFO  
	  end if  
	   
	  If Items.ItemType  =  4 Then  
	   	  'Set default values in case of cost items  
	   	  var.whwmd400.obpr  =  3 ' By Location  
	  end if  
	  var.whwmd400.obpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.obpr, var.whwmd400.obpr, Items.Exception, DefaultFound, 3)  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case of Location Controlled  
'  |   **********************************************************************************************   	   
	  if Items.LocationControlled  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.locc  =  1 ' Yes  
	  Else  
	   	  var.whwmd400.locc  =  Items.LocationControlled  
	  End if  
	  If Items.ItemType  =  4 Then  
	   	  'Set default values in case of cost items  
	   	  var.whwmd400.locc  =  2 ' No  
	  End if  	   
	  var.whwmd400.locc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.locc, var.whwmd400.locc, Items.Exception, DefaultFound, 1)  
'  |   **********************************************************************************************   	   	   
'  |  In case of Lot Controlled  
'  |   **********************************************************************************************   	   
	  If Items.LotPrice  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.ltpr  =  2 ' No  
	  Else  
	   	  var.whwmd400.ltpr  =  Items.LotPrice  	   
	  End if  
	  if Items.LotControlled  =  1 then  
	   	  if Items.LotsInInventory  =  1 then  
	   	   	  'Lot controlled and in inventory  
	   	   	  var.whwmd400.lttr  =  1 'Yes  
	   	   	  var.whwmd400.linv  =  1 'Yes  
	   	   	  var.whwmd400.ledd  =  3 'Not applicable  
	   	   	  var.whwmd400.ledr  =  3 'Not applicable  
	   	   	  var.whwmd400.ledt  =  3 'Not applicable  
	   	   	  var.whwmd400.lisf  =  3 'Not applicable  
	   	   	  var.whwmd400.lism  =  3 'Not applicable  
	   	  else  
	   	   	  'Lot controlled not in inventory  
	   	   	  var.whwmd400.lttr  =  1 'Yes  
	   	   	  var.whwmd400.linv  =  2 'No  
	   	   	  var.whwmd400.ledd  =  1 'Yes  
	   	   	  var.whwmd400.ledr  =  2 'No  
	   	   	  var.whwmd400.ledt  =  2 'No  
	   	   	  var.whwmd400.lisf  =  2 'No  
	   	   	  var.whwmd400.lism  =  2 'No  
	   	  end if  
	   	   
	  else  
	   	  'Not lot controlled  
	   	  var.whwmd400.ltpr  =  2 'No  
	   	  var.whwmd400.lttr  =  2 'No  
	   	  var.whwmd400.linv  =  2 'No  
	   	  var.whwmd400.ledd  =  3 'Not applicable  
	   	  var.whwmd400.ledr  =  3 'Not applicable  
	   	  var.whwmd400.ledt  =  3 'Not applicable  
	   	  var.whwmd400.lisf  =  3 'Not applicable  
	   	  var.whwmd400.lism  =  3 'Not applicable  
	  end if  
	   
	  var.whwmd400.ltpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ltpr, var.whwmd400.ltpr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.lttr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lttr, var.whwmd400.lttr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.linv  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.linv, var.whwmd400.linv, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.ledd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledd, var.whwmd400.ledd, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.ledr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledr, var.whwmd400.ledr, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.ledt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledt, var.whwmd400.ledt, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.lisf  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lisf, var.whwmd400.lisf, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.lism  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lism, var.whwmd400.lism, Items.Exception, DefaultFound, 3)  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case Serialized  
'  |   **********************************************************************************************   	   
	  If Items.SerialPrice  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.srpr  =  2 ' No  
	  Else  
	   	  var.whwmd400.srpr  =  Items.SerialPrice  	   
	  End if  
	  if Items.Serialized  =  1 then  
	   	  if Items.SerialsInInventory  =  1 then  
	   	   	  'Serialized and in inventory  
	   	   	  var.whwmd400.srtr  =  1 'Yes  
	   	   	  var.whwmd400.sinv  =  1 'Yes  
	   	   	  var.whwmd400.sedd  =  3 'Not applicable  
	   	   	  var.whwmd400.sedr  =  3 'Not applicable  
	   	   	  var.whwmd400.sedt  =  3 'Not applicable  
	   	   	  var.whwmd400.sisf  =  3 'Not applicable  
	   	   	  var.whwmd400.sism  =  3 'Not applicable  
	   	  else  
	   	   	  'Serialized not in inventory  
	   	   	  var.whwmd400.srtr  =  1 'Yes  
	   	   	  var.whwmd400.sinv  =  2 'No  
	   	   	  var.whwmd400.sedd  =  1 'Yes  
	   	   	  var.whwmd400.sedr  =  2 'No  
	   	   	  var.whwmd400.sedt  =  2 'No  
	   	   	  var.whwmd400.sisf  =  2 'No  
	   	   	  var.whwmd400.sism  =  2 'No  
	   	  end if  
	  else  
	   	  ' Not serialized  
	   	  var.whwmd400.srpr  =  2 'No  
	   	  var.whwmd400.srtr  =  2 'No  
	   	  var.whwmd400.sinv  =  2 'No  
	   	  var.whwmd400.sedd  =  3 'Not applicable  
	   	  var.whwmd400.sedr  =  3 'Not applicable  
	   	  var.whwmd400.sedt  =  3 'Not applicable  
	   	  var.whwmd400.sisf  =  3 'Not applicable  
	   	  var.whwmd400.sism  =  3 'Not applicable  
	  end if  
	   
	  var.whwmd400.srpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.srpr, var.whwmd400.srpr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.srtr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.srtr, var.whwmd400.srtr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.sinv  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sinv, var.whwmd400.sinv, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.sedd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedd, var.whwmd400.sedd, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sedr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedr, var.whwmd400.sedr, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sedt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedt, var.whwmd400.sedt, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sisf  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sisf, var.whwmd400.sisf, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sism  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sism, var.whwmd400.sism, Items.Exception, DefaultFound, 3)  
	   	   	   	   	   	   	   	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item service Data (tsmdm200)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsService.*   
	  from  	  ItemDefaultsService  
	  where  	  ItemDefaultsService.kitm  =  varint.itemtype And ItemDefaultsService.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	   
	  'Defaults presents but not in Item access table  	   
	  var.tsmdm200.acos  =  ItemHandling.GetTypeEnum(ItemDefaultsService.acos, 0, Items.Exception, DefaultFound, 70)  
	  var.tsmdm200.cinc  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cinc, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tsmdm200.cmtc  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cmtc, 0, Items.Exception, DefaultFound, 20)  
	  var.tsmdm200.cmts  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cmts, 0, Items.Exception, DefaultFound, 20)  
	  var.tsmdm200.cvco  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cvco, 0, Items.Exception, DefaultFound, 15)  	   
	  var.tsmdm200.cpit  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cpit, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tsmdm200.dltp  =  ItemHandling.GetTypeEnum(ItemDefaultsService.dltp, 0, Items.Exception, DefaultFound, 4)  
	  var.tsmdm200.dtps  =  ItemHandling.GetTypeEnum(ItemDefaultsService.dtps, 0, Items.Exception, DefaultFound, 10)  
	  var.tsmdm200.owns  =  ItemHandling.GetTypeEnum(ItemDefaultsService.owns, 0, Items.Exception, DefaultFound, 10)  	  'LN10_4.n  
	  var.tsmdm200.rmcr  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rmcr, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rmsr  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rmsr, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rncw  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rncw, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rpyn  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rpyn, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rwun  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rwun, 0, Items.Exception, DefaultFound, 5)  
	  var.tsmdm200.scir  =  ItemHandling.GetTypeEnum(ItemDefaultsService.scir, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tsmdm200.sirq  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sirq, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.sswt  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sswt, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.sttp  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sttp, 0, Items.Exception, DefaultFound, 15)  	  'LN10_4.n  
	  var.tsmdm200.uval  =  ItemHandling.GetTypeEnum(ItemDefaultsService.uval, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.blag  =  ItemHandling.GetTypeString(ItemDefaultsService.blag, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ccds  =  ItemHandling.GetTypeString(ItemDefaultsService.ccds, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ccme  =  ItemHandling.GetTypeString(ItemDefaultsService.ccme, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ckgr  =  ItemHandling.GetTypeString(ItemDefaultsService.ckgr, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cmea  =  ItemHandling.GetTypeString(ItemDefaultsService.cmea, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cmpo  =  ItemHandling.GetTypeString(ItemDefaultsService.cmpo, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cogr  =  ItemHandling.GetTypeString(ItemDefaultsService.cogr, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cwte  =  ItemHandling.GetTypeString(ItemDefaultsService.cwte, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.gwte  =  ItemHandling.GetTypeString(ItemDefaultsService.gwte, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.peru  =  ItemHandling.GetTypeString(ItemDefaultsService.peru, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.prun  =  ItemHandling.GetTypeString(ItemDefaultsService.prun, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.sbct  =  ItemHandling.GetTypeString(ItemDefaultsService.sbct, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.scme  =  ItemHandling.GetTypeString(ItemDefaultsService.scme, "", Items.Exception, DefaultFound)  	   	  'LN10_4.n  
	  var.tsmdm200.smpo  =  ItemHandling.GetTypeString(ItemDefaultsService.smpo, "", Items.Exception, DefaultFound)  	   	  'LN10_4.n  
	  var.tsmdm200.swte  =  ItemHandling.GetTypeString(ItemDefaultsService.swte, "", Items.Exception, DefaultFound)  
	   
	  var.tsmdm200.mepo  =  ItemHandling.GetTypeNumber(ItemDefaultsService.mepo, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.nrpe  =  ItemHandling.GetTypeNumber(ItemDefaultsService.nrpe, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.rwdu  =  ItemHandling.GetTypeNumber(ItemDefaultsService.rwdu, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.srpd  =  ItemHandling.GetTypeNumber(ItemDefaultsService.srpd, 0, Items.Exception, DefaultFound)  
	   
	  'Defaults presents and present in Item access table  
	  var.tsmdm200.ccur  =  ItemHandling.GetTypeString(ItemDefaultsService.ccur, Items.ServiceCurrency, Items.Exception, DefaultFound)  
	  var.tsmdm200.cups  =  ItemHandling.GetTypeString(ItemDefaultsService.cups, Items.SalesUnit, Items.Exception, DefaultFound)  
	  var.tsmdm200.cuqs  =  ItemHandling.GetTypeString(ItemDefaultsService.cuqs, Items.SalesUnit, Items.Exception, DefaultFound)  
	  var.tsmdm200.cwoc  =  ItemHandling.GetTypeString(ItemDefaultsService.cwoc, Items.ServiceDepartment, Items.Exception, DefaultFound)  
	  var.tsmdm200.sigr  =  ItemHandling.GetTypeString(ItemDefaultsService.sigr, Items.SerializedItemGroup, Items.Exception, DefaultFound)  
	  var.tsmdm200.pris  =  ItemHandling.GetTypeNumber(ItemDefaultsService.pris, Items.ServicePrice, Items.Exception, DefaultFound)  
	   
'  |   **********************************************************************************************   	   	   
'  |   *  Setting variables for Item Service Data (tsmdm200)  
'  |   **********************************************************************************************   	   
	  If Items.ConfigurationControlled  <>  1 then  
	   	  var.tsmdm200.csgr  =  ItemHandling.GetTypeString(ItemDefaultsService.csgr, "", Items.Exception, DefaultFound)  
	  Else  
	   	  var.tsmdm200.csgr  =  ItemHandling.GetTypeString(ItemDefaultsService.csgr, Items.ServiceItemGroup, Items.Exception, DefaultFound)  
	  End if  
	   
	  If Items.ConfigurationControlled  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tsmdm200.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsService.seri, 0, Items.Exception, DefaultFound, 3)  	   
	  Else  
	   	  var.tsmdm200.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsService.seri, Items.ConfigurationControlled, Items.Exception, DefaultFound, 3)  	   
	  End If  
	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Project Data (tppdm005)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsProject.*   
	  from  	  ItemDefaultsProject  
	  where  	  ItemDefaultsProject.kitm  =  varint.itemtype And ItemDefaultsProject.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	   
	  'Defaults presents but not in Item access table  
	  var.tppdm005.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsProject.txta, 0, Items.Exception, DefaultFound)  
	  'Defaults presents and present in Item access table  	   
	  var.tppdm005.ccur  =  ItemHandling.GetTypeString(ItemDefaultsProject.ccur, Items.CostPriceCurrency, Items.Exception, DefaultFound)  
	   
	  If Items.ControlFunction  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.ccfu  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.ccfu, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.ccfu  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.ccfu, Items.ControlFunction, Items.Exception, DefaultFound, 1)  
	  End If  	   
	   	   
	  If Items.ProjectOrderSystem  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, 0, Items.Exception, DefaultFound, 9)  
	  Else  	   
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, Items.ProjectOrderSystem, Items.Exception, DefaultFound, 9)  
	  End If  
	   
	  If Item.PricePolicy  =  0 Then  
	   	  'Use default value if not specified  	   
	   	  var.tppdm005.cppp  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.cppp, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.cppp  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.cppp, Item.PricePolicy, Items.Exception, DefaultFound, 1)  
	  End if  	   	   
	   
	  If Items.ProjectOrderSystem  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, 0, Items.Exception, DefaultFound, 9)  
	  Else  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, Items.ProjectOrderSystem, Items.Exception, DefaultFound, 9)  
	  End if  	   
	   	   
	  If Items.RegisterProgress  =  0 Then  
	   	  'Use default value if not specified  	   
	   	  var.tppdm005.prre  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.prre, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.prre  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.prre, Items.RegisterProgress, Items.Exception, DefaultFound, 1)  	   
	  End If  
	   
	  var.tppdm005.ccit  =  get.segment.item.code(Items.CCItemProjectSegment, Items.CCItemItemSegment)  
	  var.tppdm005.ccit  =  ItemHandling.GetTypeString(ItemDefaultsProject.ccit, var.tppdm005.ccit, Items.Exception, DefaultFound)  	   
	   
	   
'  |   **********************************************************************************************   	   
'  |   *  Actual Dump Section  
'  |   **********************************************************************************************   	   
	  dump 001 '  |   *  Dump for tcibd001  
	  dump 400 '  |   *  Dump for whwmd400  
	   
	  if Items.ItemPurchaseData  <>  2 then  
	   	  dump 002 '  |   *  Dump for tdipu001  
	   	  dump 102 '  |   *  Dump for tdipu100  
	  end if  
	   
	  if Items.ItemSalesData  <>  2 then  
	   	  dump 003 '  |   *  Dump for tdisa001  
	  end if  
	   
	  if Items.ItemProductionData  <>  2 and _  
	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5) then  
	   	  dump 004 '  |   *  Dump for tiipd001  
	  end if  
	   
	  if Items.ItemType  <>  6 and Items.ItemType  <>  10 then  
	   	  dump 007 '  |   *  Dump for ticpr007  
	  end if  
	   
	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  10) then  
	   	  dump 100 '  |   *  Dump for tcibd100  
	  end if  
	   
	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5 or Items.ItemType  =  10) then  
	   	  cluster.found  =  0  
	   	  If varstr.cprj  =  "" or IsNUll(varstr.cprj) then  
	   	   	  select  	  ItemsByCluster.*   
	   	   	  from  	  ItemsByCluster  
	   	   	  where  	  (ItemsByCluster.Project  =  "" and ItemsByCluster.Item  =  varstr.item)  
	   	   	  selectdo  
	   	   	   	  cluster.found  =  1  
	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	   
	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	   
	   	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	   	  ' dump 120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
	   	   	  endselect  
	   	  Else  
	   	   	  select  	  ItemsByCluster.*   
	   	   	  from  	  ItemsByCluster  
	   	   	  where  	  (ItemsByCluster.Project  =  varstr.cprj and ItemsByCluster.Item  =  varstr.item)  
	   	   	  selectdo  
	   	   	   	  cluster.found  =  1  
	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	   
	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	   
	   	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	   	  'dump 120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
	   	   	  endselect  
	   	  End If  	   	   
	   	  if cluster.found  =  0 then  
	   	   	  varstr.clus  =  "   "  	   	   
	   	   	  var.planned.item  =  get.segment.cp.item.code(varstr.clus,varstr.cprj,varstr.item)  
	   	   	  var.cprpd100.cwar  =  Items.Warehouse  	   	   	   
	   	   	  var.cprpd100.sour  =  1  	   	   	   	   	   
	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	  ' dump 120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
	   	  end if  
	   	  dump 200 '  |   *  Dump for tcibd200  
	  end if  
	   
	  if Items.ItemServiceData  <>  2 and _  
	   	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  
	   	   	  dump 201 '  |   *  Dump for tsmdm200  
	  end if  
	  if Items.ItemProjectData  <>  2 then  
	   	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  	   
	   	   	  dump 005 '  |   *  Dump for tppdm005  
	   	  end if  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:S
:QURY:START
select  	   	  Items.*
from 	   	  Items
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:X
:QURY:START
'  |   **********************************************************************************************   	   
'  |  Restructured the script for the implementation of the item defaulting.  
'  |   	   
'  |  Cleaned Source for the below solutions and marking related to previous FP version  <  9  
'  |   -  243214  
'  |   -  244255  
'  |   -  244268  
'  |   -  244355  
'  |   -  249608  
'  |   **********************************************************************************************
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:D
:QURY:START
	  dump 64 '  |  PE to tcibd001  
	  dump 65 '  |  PE to tdipu001  
	  dump 66 '  |  PE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:S
:QURY:START
select ProjectEquipments.*
from ProjectEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:D
:QURY:START
	  if ProjectSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuti  
	  end if  
	  dump 74 '  |   *  PS to tcibd001  
	  dump 75 '  |   *  PS to tdipu001  
	  dump 76 '  |   *  PS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:S
:QURY:START
select ProjectSubcontractings.*
from ProjectSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:D
:QURY:START
	  if StandardEquipments.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 61 '  |   *  SE to tcibd001  
	  dump 62 '  |   *  SE to tdipu001  
	  dump 63 '  |   *  SE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:S
:QURY:START
select StandardEquipments.*
from StandardEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:D
:QURY:START
	  if StandardSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuti  
	  end if  
	  if StandardSubcontractings.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 71 '  |   *  SS to tcibd001  
	  dump 72 '  |   *  SS to tdipu001  
	  dump 73 '  |   *  SS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:S
:QURY:START
select StandardSubcontractings.*
from StandardSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:004
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemCodesByItemCodeSystem
:ICOD:D
:QURY:START
dump 004
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:004
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemCodesByItemCodeSystem
:ICOD:S
:QURY:START
select ItemCodesByItemCodeSystem.*
from ItemCodesByItemCodeSystem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:ibd
:TFLNO:004
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemCodesByItemCodeSystem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:mcs
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Units
:ICOD:D
:QURY:START
	  dump 01 '  |   *  Units  
	  if trim(var.DefaultUnitSet)  <>  "" then  
	   	  dump 012 '  |   *  Units by Unit Set  	   
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:mcs
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Units
:ICOD:S
:QURY:START
select Units.*
from Units
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tc
:TCMOD:mcs
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Units
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:D
:QURY:START
	  var.tdipu010.scrp  =  ItemPurchaseBP.SourcingPercentage  
	  if (var.tdipu010.scrp  =  "0") then  
	   	  var.tdipu010.scrp  =  100  
	  end if  
	   
	  var.tdipu010.efdt  =  get.utc(ItemPurchaseBP.EffectiveDate,"yes")  
	  'var.tdipu010.exdt  =  get.utc(ItemPurchaseBP.ExpDate,"yes")  
	  If ItemPurchaseBP.ExpDate  =  "" or IsNull(ItemPurchaseBP.ExpDate) then  	   
	   	  var.tdipu010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tdipu010.exdt  =  get.utc(ItemPurchaseBP.ExpDate,"yes")  
	  end if  
	  varstr.cprj  =  ItemPurchaseBP.Project  
	  varstr.item  =  ItemPurchaseBP.Item  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select  	  Items.*   
	   	  from  	   	  Items  
	   	  where  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  else  
	   	  select Items.*   
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj AND Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  end if  
	  dump 010  	  '  |   #  tdipu010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:S
:QURY:START
select ItemPurchaseBP.*
from ItemPurchaseBP
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:D
:QURY:START
	  var.tdisa010.efdt  =  get.utc(ItemSalesBP.EffectiveDate,"yes")  
	  'var.tdisa010.exdt  =  get.utc(ItemSalesBP.ExpDate,"yes")  	   
	  If ItemSalesBP.ExpDate  =  "" or IsNull(ItemSalesBP.ExpDate) then  	   
	   	  var.tdisa010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tdisa010.exdt  =  get.utc(ItemSalesBP.ExpDate,"yes")  
	  end if  
dump 010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:S
:QURY:START
select ItemSalesBP.*
from ItemSalesBP
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:td
:TCMOD:pcg
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBookCodes
:ICOD:D
:QURY:START
dump 011
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:td
:TCMOD:pcg
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBookCodes
:ICOD:S
:QURY:START
select PriceBookCodes.*
from PriceBookCodes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:td
:TCMOD:pcg
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBookCodes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionType
:ICOD:D
:QURY:START
	  dump 002  	  '  |  tfgld002
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionType
:ICOD:S
:QURY:START
select DimensionType.*
from DimensionType
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DimensionType
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:D
:QURY:START
	  If Trim(varstr.SourceGLVersion)  =  "Other" then  
	  '  |  Migrate non  -  InforFMS data  
	   	  if ChartOfAccounts.Dimension1Used  =  "0" then  
	   	   	  var.dim1  =  2 '  |  Optional  
	   	  else  
	   	   	  var.dim1  =  ChartOfAccounts.Dimension1Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension2Used  =  "0" then  
	   	   	  var.dim2  =  2  
	   	  else  
	   	   	  var.dim2  =  ChartOfAccounts.Dimension2Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension3Used  =  "0" then  
	   	   	  var.dim3  =  2  
	   	  else  
	   	   	  var.dim3  =  ChartOfAccounts.Dimension3Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension4Used  =  "0" then  
	   	   	  var.dim4  =  2  
	   	  else  
	   	   	  var.dim4  =  ChartOfAccounts.Dimension4Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension5Used  =  "0" then  
	   	   	  var.dim5  =  2  
	   	  else  
	   	   	  var.dim5  =  ChartOfAccounts.Dimension5Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension6Used  =  "0" then  
	   	   	  var.dim6  =  2  
	   	  else  
	   	   	  var.dim6  =  ChartOfAccounts.Dimension6Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension7Used  =  "0" then  
	   	   	  var.dim7  =  2  
	   	  else  
	   	   	  var.dim7  =  ChartOfAccounts.Dimension7Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension8Used  =  "0" then  
	   	   	  var.dim8  =  2  
	   	  else  
	   	   	  var.dim8  =  ChartOfAccounts.Dimension8Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension9Used  =  "0" then  
	   	   	  var.dim9  =  2  
	   	  else  
	   	   	  var.dim9  =  ChartOfAccounts.Dimension9Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension10Used  =  "0" then  
	   	   	  var.dim10  =  2  
	   	  else  
	   	   	  var.dim10  =  ChartOfAccounts.Dimension10Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension11Used  =  "0" then  
	   	   	  var.dim11  =  2  
	   	  else  
	   	   	  var.dim11  =  ChartOfAccounts.Dimension11Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension12Used  =  "0" then  
	   	   	  var.dim12  =  2  
	   	  else  
	   	   	  var.dim12  =  ChartOfAccounts.Dimension12Used  
	   	  end if  
	   	  if ChartOfAccounts.DualAccountingIndicator  =  "0" then  
	   	   	  var.duac  =  1  
	   	  else  
	   	   	  var.duac  =  ChartOfAccounts.DualAccountingIndicator  
	   	  end if  
	   	  if ChartOfAccounts.FixedAssetIntegration  =  "0" then  
	   	   	  var.ifas  =  4  
	   	  else  
	   	   	  var.ifas  =  ChartOfAccounts.FixedAssetIntegration  
	   	  end if  
	   	  if ChartOfAccounts.IntegrationAccount  =  "0" then  
	   	   	  var.inta  =  2  
	   	  else  
	   	   	  var.inta  =  ChartOfAccounts.IntegrationAccount  
	   	  end if  
	   	  if ChartOfAccounts.IntegrationIndicator  =  "0" then  
	   	   	  var.iprj  =  7  
	   	  else  
	   	   	  var.iprj  =  ChartOfAccounts.IntegrationIndicator  
	   	  end if  
	   	  if ChartOfAccounts.BlockingStatus  =  "0" or Trim(ChartOfAccounts.BlockingStatus)  =  "" then  
	   	   	  var.bloc  =  1  
	   	  else  
	   	   	  var.bloc  =  ChartOfAccounts.BlockingStatus  
	   	  end if  
	   	  if var.bloc  =  1 then  
	   	   	  var.bfdt  =  get.date("","no")  
	   	   	  var.budt  =  get.date("","no")  
	   	  else  
	   	   	  var.bfdt  =  get.date(ChartOfAccounts.BlockingEffectiveFrom,"no")  
	   	   	  var.budt  =  get.date(ChartOfAccounts.BlockingEffectiveTo,"no")  
	   	  end if  
	   	  dump 008 ' | Other GL Source version  
	  else  
	  '  |  Migrate InforFMS data  
	   	  '  |  Mapping of AccountType to D  /  C Indicator  
	   	  acc.type  =  ChartOfAccounts.AccountTypeInforFMS  
	   	  if trim(acc.type)  <>  "" then  
	   	   	  varstr.OpenDate  =  ChartOfAccounts.OpenDateInforFMS  
	   	   	  varstr.ClosedDate  =  ChartOfAccounts.ClosedDateInforFMS  
	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Closed" then  
	   	   	   	  if varstr.OpenDate  =  "" then  
	   	   	   	   	  varstr.OpenDate  =  date()  
	   	   	   	  end if  
	   	   	   	  if varstr.ClosedDate  =  "" then  	   	   	   
	   	   	   	   	  varstr.ClosedDate  =  CDate("12/31/2038")  
	   	   	   	  end if  
	   	   	  end if  
	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Open" then  
	   	   	   	  varstr.OpenDate  =  ""  
	   	   	   	  varstr.ClosedDate  =  ""  
	   	   	  end if  
	   	   	  If acc.type  =  "A" or acc.type  =  "E" or acc.type  =  "V" or acc.type  =  "B" then  
	   	   	   	  varint.DebitCreditIndicator  =  1 '  |  tfgld.dbcr.debit '  |  1 '  |  Debit  
	   	   	  End If  	   
	   	   	  If acc.type  =  "L" or acc.type  =  "I" then  
	   	   	   	  varint.DebitCreditIndicator  =  2 '  |  tfgld.dbcr.credit '  |  2 '  |  Credit  	   
	   	   	  End If  	   
	   	   	  '  |  Mentioning the Account Type  
	   	   	  If acc.type  =  "A" or acc.type  =  "L" or acc.type  =  "B" then  
	   	   	   	  varint.AccountType  =  1 '  |  Balance Sheet  
	   	   	  End If  
	   	   	  if acc.type  =  "E" or acc.type  =  "V" or acc.type  =  "I" then  
	   	   	   	  varint.AccountType  =  2 '  |  Profit  &  Loss  
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GL2" then  
	   	   	   	  '  |  Determining the Status for the Blocking field  
	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free '  |  1  
	   	   	   	  '  |  Currency Analysis  
	   	   	   	  var.icur  =  1 '  |  tcicur.not.required '  |  1  
	   	   	   	  '  |  For Sublevel  
	   	   	   	  var.sublevel  =  0 '  |  ChartOfAccounts.Sublevel '  |  default()  
	   	   
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GL3" then  
	   	   	   	  '  |  Determining the Status for the Blocking field  
	   	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Open" then  
	   	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free '  |  1  
	   	   	   	  else  	   	   
	   	   	   	   	  var.status  =  3 '  |  tfgld.bloc.all.input '  |  3  
	   	   	   	  end if  
	   	   	   	  '  |  Currency Analysis  
	   	   	   	  var.icur  =  2 '  |  tcicur.required '  |  2  
	   	   	   	  '  |  For Sublevel  
	   	   	   	  var.sublevel  =  0 '  |  ChartOfAccounts.Sublevel '  |  default()  
	   
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GLE" then  
	   	   	   	  if acc.type  =  "1" or acc.type  =  "5" or acc.type  =  "6" or acc.type  =  "8" then  
	   	   	   	   	  varint.DebitCreditIndicator  =  1 '  |  tfgld.dbcr.debit  
	   	   	   	  end if  	   
	   	   	   	  if acc.type  =  "2" or acc.type  =  "3" or acc.type  =  "4" or acc.type  =  "7" then  
	   	   	   	   	  varint.DebitCreditIndicator  =  2 '  |  tfgld.dbcr.credit  
	   	   	   	  end if  	   
	   	   	   	  '  |  Mentioning the Account Type  
	   	   	   	  if acc.type  =  "1" or acc.type  =  "2" or acc.type  =  "3" then  
	   	   	   	   	  varint.AccountType  =  1 '  |  Balance Sheet  
	   	   	   	  else  
	   	   	   	   	  varint.AccountType  =  2 '  |  Profit  &  Loss  
	   	   	   	  end if  	   
	   	   	   	  '  |  Currency Analysis  	   
	   	   	   	  var.icur  =  1 '  |  tcicur.not.required  
	   	   	   	  '  |  Status of Blocking field  
	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free  
	   	   	   	  '  |  Calculating Sublevel  
	   	   	   	  var.sublevel  =  ChartOfAccounts.LedgerAccountSublevel  
	   
	   	   	  end if  
	   	   	  dump 009 '  |  Chart Of Accounts InforFMS  
	   	  end if  
	  End If
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:S
:QURY:START
select ChartOfAccounts.*
from ChartOfAccounts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:D
:QURY:START
	  dump 011
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:S
:QURY:START
select TransactionTypes.*
from TransactionTypes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:051
:SCPAC:bc
:SCMOD:tbl
:SFLNO:CrossValidationRules
:ICOD:D
:QURY:START
	  if ((hold.validationrule  <>  CrossValidationRules.ValidationRule) or _  
	  (hold.version  <>  CrossValidationRules.Version)) then  
	   	  ' Dump validation Rule header record  
	   	  dump 051  	  '  |  For tfgld051  
	   	  hold.validationrule  =  CrossValidationRules.ValidationRule  
	   	  hold.version  =  CrossValidationRules.Version  
	  end if  
	   
	  'Dump validation rule lines (each record)  	   	   
	  dump 052  	  '  |  For tfgld052  
	
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:051
:SCPAC:bc
:SCMOD:tbl
:SFLNO:CrossValidationRules
:ICOD:S
:QURY:START
select  	  CrossValidationRules.*
from 	  CrossValidationRules
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:051
:SCPAC:bc
:SCMOD:tbl
:SFLNO:CrossValidationRules
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:D
:QURY:START
	  If varstr.source.gl.version  =  "GL2" or varstr.source.gl.version  =  "GL3" then  
	  '  |  Migrate data for InforFMS 'M  -  Series'  
	   	  If GLTransactions.CurrencySource  =  empty then  
	   	   	  varstr.currency  =  GeneralParameters.BookingCurrency1  
	   	  Else  
	   	   	  varstr.currency  =  GLTransactions.CurrencySource  
	   	  End If  
	   	   
	   	  var.rate1  =  get.rate(GLTransactions.Rate1, var.RateFactor1)  
	   	  var.rate2  =  get.rate(GLTransactions.Rate2, var.RateFactor2)  
	   	  If GLTransactions.RateDate  =  empty then  
	   	   	  var.RateDate  =  GLTransactions.EffectiveDateInforFMS  
	   	  Else  
	   	   	  var.RateDate  =  GLTransactions.RateDate  
	   	  End If  
	   	  if trim(var.rate1)  =  "" then  	   
	   	   	  var.rate1  =  "1.000000"  
	   	  end if  
	   	  if trim(var.rate2)  =  "" then  	   
	   	   	  var.rate2  =  "0.000001"  
	   	  end if  
	   	  If GLTransactions.RateTypeSource  =  empty then  
	   	   	  varstr.RateType  =  GeneralParameters.ExchangeRateType  
	   	  Else  
	   	   	  varstr.RateType  =  GLTransactions.RateTypeSource  
	   	  End If  
	   	  If varstr.source.gl.version  =  "GL2" then  
	   	   	  var.GLTransaction.BookingAmount2  =  GLTransactions.BookingAmount2  
	   	  Else  
	   	   	  var.GLTransaction.BookingAmount2  =  0  
	   	  End If  
	   	  If GLTransactions.EffectiveDateInforFMS  <>  varstr.PrevEffectiveDate then  
	   	   	  var.tfgld106.olin  =  1  	   
	   	   	  If varstr.source.gl.version  =  "GL2" then  	   
	   	   	   	  var.DocumentID  =  var.DocumentID  +  1  
	   	   	   	  dump 018 '  |  Documents InforFMS GL2  /  GL3  
	   	   	  End If  
	   	  Else  
	   	   	  var.tfgld106.olin  =  var.tfgld106.olin  +  1  
	   	  End if  
	   	  varstr.PrevEffectiveDate  =  GLTransactions.EffectiveDateInforFMS  
	  End If  
	  varstr.dim2  =  Mid (GLTransactions.Reference1 , 22 , 1 )  
	  varstr.dim3  =  Mid (GLTransactions.Reference1 , 24 , 9 )  
	  dump 106 '  |  Finalized Transactions InforFMS GL2  /  GL3  
	  If varstr.source.gl.version  =  "GLE" then  
	  '  |  Migrate data for InforFMS 'E  -  Series'  
	   	  select  	  GLTransactions.*   
	   	  from  	  GLTransactions  
	   	  order by GLTransactions.FiscalYear, GLTransactions.Period Asc  
	   	  selectdo  
	   	   	  If GLTransactions.CurrencySource  =  empty then  
	   	   	   	  varstr.currency  =  GeneralParameters.BookingCurrency1  
	   	   	  Else  
	   	   	   	  varstr.currency  =  GLTransactions.CurrencySource  
	   	   	  End If  
	   	   	  var.rate1  =  get.rate(GLTransactions.Rate1, var.RateFactor1)  
	   	   	  var.rate2  =  get.rate(GLTransactions.Rate2, var.RateFactor2)  
	   	   	  If GLTransactions.RateDate  =  empty then  
	   	   	   	  var.RateDate  =  GLTransactions.EffectiveDate  
	   	   	  Else  
	   	   	   	  var.RateDate  =  GLTransactions.RateDate  
	   	   	  End If  
	   	   	  If GLTransactions.RateTypeSource  =  empty then  
	   	   	   	  varstr.RateType  =  GeneralParameters.ExchangeRateType  
	   	   	  Else  
	   	   	   	  varstr.RateType  =  GLTransactions.RateTypeSource  
	   	   	  End If  
	   	   	  If GLTransactions.FiscalYear  <>  varint.PrevFiscalYear Or GLTransactions.Period  <>  varint.PrevPeriod then  
	   	   	   	  var.DocumentID  =  var.DocumentID  +  1  
	   	   	   	  dump 918 '  |  Documents InforFMS GLE  
	   	  End If  
	   	  varint.PrevFiscalYear  =  GLTransactions.FiscalYear  
	   	  varint.PrevPeriod  =  GLTransactions.Period  
	   	  dump 906 '  |  Finalized Transactions InforFMS GLE  
	  endselect  
End If  
If varstr.source.gl.version  =  "Other" then  
'  |  Migrate data for other source systems  
End If
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:S
:QURY:START
select  	  GLTransactions.*
from 	  GLTransactions  
'  |  order by GLTransactions.EffectiveDateInforFMS Asc
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:D
:QURY:START
	  var.tibom010.indt  =  get.utc(BillOfMaterial.EffectiveDate,"yes")  
	  'var.tibom010.exdt  =  get.utc(BillOfMaterial.ExpiryDate,"no")  	   	   
	  If BillOfMaterial.ExpiryDate  =  "" or IsNull(BillOfMaterial.ExpiryDate) then  	   
	   	  var.tibom010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tibom010.exdt  =  get.utc(BillOfMaterial.ExpiryDate,"no")  
	  end if  
	  dump 010 '  |  tibom010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:S
:QURY:START
select BillOfMaterial.*
from BillOfMaterial
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionDepartment
:ICOD:D
:QURY:START
	  varstr.address  =  ProductionDepartment.Address  
	  select Addresses.City  
	  from Addresses  
	  where Addresses.AddressCode  =  varstr.address  
	  selectdo  
	  endselect  
	   
	  var.tcmcs065.city  =  Left(Addresses.City, 8)  
	   
	  if ProductionDepartment.EnterpriseUnit  =  "" or IsNull (ProductionDepartment.EnterpriseUnit) then  
	   	  var.EnterpriseUnit  =  GeneralParameters.DefaultEnterpriseUnit  
	  else  
	   	  var.EnterpriseUnit  =  ProductionDepartment.EnterpriseUnit  
	  end if  	   
	  dump 365 '  |  pddp tcmcs065  
	  dump 310 '  |  pddp tcemm110  
	  dump 324 '  |  pddp tcemm124
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionDepartment
:ICOD:S
:QURY:START
select ProductionDepartment.*
from ProductionDepartment
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionDepartment
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:D
:QURY:START
	  if Projects.btco  =  1 then  
	   	  var.tppdm600.cmog  =  2  
	  else  
	   	  var.tppdm600.cmog  =  3  
	  end if  
	  if Projects.intp  =  1 then  
	   	  var.tppdm600.ipin  =  2  
	  else  
	   	  var.tppdm600.ipin  =  1  
	  end if  
	  var.tppdm600.rate  =  Projects.rate  
	  if trim(var.tppdm600.rate)  =  "" or IsNull(var.tppdm600.rate) then  
	   	  var.tppdm600.rate  =  1  
	  end if  
	  var.tppdm600.guid  =  "MIG_tppdm600_"  &  Projects.cprj  	   
	  dump 600 '  |  TP to tppdm600  
	  dump 113 '  |  TP to tcemm113  
	  dump 610 '  |  TP to tcemm110
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:S
:QURY:START
select Projects.*
from Projects
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:D
:QURY:START
	  varstr.address  =  WorkCenter.Address  
	  select Addresses.City  
	  from  	  Addresses  
	  where Addresses.AddressCode  =  varstr.address  
	  selectdo  
	  endselect  
	   
	  var.tcmcs065.city  =  Left(Addresses.City, 8)  
	  dump 001 '  |  cwoc tirou001  
	  dump 065 '  |  cwoc tcmcs065  
	  dump 110 '  |  cwoc tcemm110  
	  dump 124 '  |  cwoc tcemm124  
	  dump 200 '  |  cwoc cprpd200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:S
:QURY:START
select WorkCenter.*
from WorkCenter
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:D
:QURY:START
'  |   *  ERP  -  00000  -  51389.sn  
	  var.cycletime  =  RoutingOperation.CycleTime  
	  varstr.cprj  =  RoutingOperation.ManufacturedProject  
	  varstr.item  =  RoutingOperation.ManufacturedItem  
	  varstr.routing  =  RoutingOperation.Routing  
	  var.quantity  =  0  
'  |   *  ERP  -  00000  -  51389.en  
	  If varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select RoutingCodesByItem.RoutingQuantity  
	   	  from  	  RoutingCodesByItem  
	   	  where RoutingCodesByItem.ManufacturedItem  =  varstr.item  
	   	  and  	  RoutingCodesByItem.Routing  =  varstr.routing  
	   	  selectdo  
	   	   	  If RoutingCodesByItem.ManufacturedProject  =  "" or IsNull(RoutingCodesByItem.ManufacturedProject) then  
	   	   	   	  var.quantity  =  RoutingCodesByItem.RoutingQuantity  
	   	   	  End If  
	   	  endselect  
	  else  
	   	  select RoutingCodesByItem.RoutingQuantity  
	   	  from  	  RoutingCodesByItem  
	   	  where RoutingCodesByItem.ManufacturedProject  =  varstr.cprj  
	   	  and  	  RoutingCodesByItem.ManufacturedItem  =  varstr.item  
	   	  and  	  RoutingCodesByItem.Routing  =  varstr.routing  
	   	  selectdo  
	   	   	  var.quantity  =  RoutingCodesByItem.RoutingQuantity  
	   	  endselect  
	  End If  
'  |   *  ERP  -  00000  -  51389.sn  
	  if var.cycletime  >  "0" then  
	   	  if var.quantity  =  "0" then  
'  |  243218.o  	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime) ,2)  
	   	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime) ,2,0,0,0) '  |  243218.n  
	   	  else  
'  |  243218.o  	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime)  *  Cdbl(var.quantity) ,2)  
	   	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime)  *  Cdbl(var.quantity) ,2,0,0,0) '  |  243218.n  
	   	  end if  
	  else  
	   	  var.tirou102.prte  =  0  
	  end if  
'  |   *  ERP  -  00000  -  51389.en  
	  var.tirou102.indt  =  get.utc(RoutingOperation.EffectiveDate,"yes")  
	  If RoutingOperation.ExpiryDate  =  "" or IsNull(RoutingOperation.ExpiryDate)then  	   
	   	  var.tirou102.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tirou102.exdt  =  get.utc(RoutingOperation.ExpiryDate,"yes")  
	  end if  	   
	  dump 102 '  |  tirou102
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:S
:QURY:START
select RoutingOperation.*
from RoutingOperation
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:ctm
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Programs
:ICOD:D
:QURY:START
	  dump 1 '  |  tpctm010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:ctm
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Programs
:ICOD:S
:QURY:START
select  	  Programs.*
from 	  Programs
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:ctm
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Programs
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:015
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardLabors
:ICOD:D
:QURY:START
	  if CDbl(StandardLabors.ratc)  >  0 then  
	   	  var.tppdm015.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm015.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardLabors.rats)  >  0 then  
	   	  var.tppdm015.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm015.ltrs  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardLabors.rati)  >  0 then  	   	   	   	  '  |   #  LN10.5.sn  
	   	  var.tppdm015.ltri  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm015.ltri  =  get.utc("","no")  
	  end if  	   	   	   	   	   	   	   	  '  |   #  LN10.5.en  
	  dump 01 '  |   #  tppdm015
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:015
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardLabors
:ICOD:S
:QURY:START
select StandardLabors.*
from StandardLabors
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:015
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardLabors
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:016
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TradeGroups
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:016
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TradeGroups
:ICOD:S
:QURY:START
select TradeGroups.*
from TradeGroups
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:016
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TradeGroups
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:D
:QURY:START
	  if CDbl(StandardEquipments.ratc)  >  0 then  
	   	  var.tppdm025.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardEquipments.rats)  >  0 then  
	   	  var.tppdm025.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrs  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardEquipments.ratp)  >  0 then  
	   	  var.tppdm025.ltrp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:S
:QURY:START
select StandardEquipments.*
from StandardEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSundryCosts
:ICOD:D
:QURY:START
	  if CDbl(StandardSundryCosts.pric)  >  0 then  
	   	  var.tppdm040.ltcp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm040.ltcp  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSundryCosts.pris)  >  0 then  
	   	  var.tppdm040.ltsp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm040.ltsp  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSundryCosts.prii)  >  0 then  	   	   	  '  |   #  LN10.5.sn  
	   	  var.tppdm040.ltip  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm040.ltip  =  get.utc("","no")  
	  end if  	   	   	   	   	   	   	   	  '  |   #  LN10.5.en  
	   
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSundryCosts
:ICOD:S
:QURY:START
select StandardSundryCosts.*
from StandardSundryCosts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:040
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSundryCosts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:S
:QURY:START
select  	  StandardSurchargesGeneralAndByCostType.*
from 	  StandardSurchargesGeneralAndByCostType
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSurchargesGeneralAndByCostType
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:615
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectLabors
:ICOD:D
:QURY:START
	  if CDbl(ProjectLabors.ratc)  >  0 then  
	   	  var.tppdm615.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm615.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectLabors.rats)  >  0 then  
	   	  var.tppdm615.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm615.ltrs  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectLabors.rati)  >  0 then  	   	   
	   	  var.tppdm615.ltri  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm615.ltri  =  get.utc("","no")  
	  end if  	   	   	   	   	   	   
	  dump 01  	  '  |   *  tppdm615
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:615
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectLabors
:ICOD:S
:QURY:START
select ProjectLabors.*
from ProjectLabors
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:615
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectLabors
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:640
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSundryCostCodes
:ICOD:D
:QURY:START
	  if Cdbl(ProjectSundryCostCodes.pric)  >  0 then  
	   	  var.tppdm640.ltpr  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm640.ltpr  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSundryCostCodes.pris)  >  0 then  
	   	  var.tppdm640.ltsp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm640.ltsp  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSundryCostCodes.prii)  >  0 then  	   	   	  '  |   #  LN10.5.sn  
	   	  var.tppdm640.ltip  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm640.ltip  =  get.utc("","no")  
	  end if  	   	   	   	   	   	   	   	  '  |   #  LN10.5.en  
	  dump 01  	  '  |   *  tppdm640
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:640
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSundryCostCodes
:ICOD:S
:QURY:START
select ProjectSundryCostCodes.*
from ProjectSundryCostCodes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:640
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSundryCostCodes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:740
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectBusinessPartners
:ICOD:D
:QURY:START
	  var.tppdm740.rate  =  ProjectBusinessPartners.rate  
	  if trim(var.tppdm740.rate)  =  "" or IsNull(var.tppdm740.rate) then  
	   	  var.tppdm740.rate  =  1  
	  end if  
	  var.tppdm740.raca  =  ProjectBusinessPartners.raca  
	  if trim(var.tppdm740.raca)  =  "" or IsNull(var.tppdm740.raca) then  
	   	  var.tppdm740.raca  =  1  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:740
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectBusinessPartners
:ICOD:S
:QURY:START
select ProjectBusinessPartners.*
from ProjectBusinessPartners
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:740
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectBusinessPartners
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:741
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractAmountsByBusinessPartners
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:741
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractAmountsByBusinessPartners
:ICOD:S
:QURY:START
select ProjectContractAmountsByBusinessPartners.*
from ProjectContractAmountsByBusinessPartners
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pdm
:TFLNO:741
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractAmountsByBusinessPartners
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pss
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Baselines
:ICOD:D
:QURY:START
	  if Baselines.crdt  =  "" or IsNull(Baselines.crdt) then  
	   	  var.tppss020.crdt  =  get.utc(date(),"yes")  
	  else  
	   	  var.tppss020.crdt  =  get.utc(Baselines.crdt,"yes")  
	  end if  
	  if (Baselines.apdt  =  "" or IsNull(Baselines.apdt)) and Baselines.bsta  =  2 then  
	   	  var.tppss020.apdt  =  get.utc(date(),"no")  
	  else  
	   	  var.tppss020.apdt  =  get.utc(Baselines.apdt,"no")  
	  end if  
	  if Baselines.lupd  =  "" or IsNull(Baselines.lupd) then  
	   	  var.tppss020.lupd  =  get.utc(date(),"yes")  
	  else  
	   	  var.tppss020.lupd  =  get.utc(Baselines.lupd,"yes")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pss
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Baselines
:ICOD:S
:QURY:START
select Baselines.*
from Baselines
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pss
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Baselines
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:D
:QURY:START
	  varstr.project  =  Activities.cprj  
	  var.btco  =  1  	   	   	   	  '  |  Default is 'Element'  
	  var.invm  =  3  	   	   	  '  |  Default is 'Installment'  
	  var.secu  =  ""  
	  var.prss  =  0.0000  
	  var.rtse.1  =  0.000000  
	  var.rtse.2  =  0.000000  
	  var.rtse.3  =  0.000000  
	  var.rfse.1  =  0  
	  var.rfse.2  =  0  
	  var.rfse.3  =  0  
	  var.prin  =  4  	   	   	   
	  var.cspt  =  3  	   	   	   
	  var.setl  =  2  
	  var.gris  =  0  
	  select Projects.invm,  
	   	  Projects.btco  
	  from  	  Projects  
	  where Projects.cprj  =  varstr.project  
	  selectdo  
	   	  var.invm  =  Projects.invm  	  '  |  Invoice Type  
	   	  var.btco  =  Projects.btco  	  '  |  Control By  
	  endselect  
	  '  |  Check if 'Invoice Type'  =  Progress Invoice and 'Control By'  =  Activity  	   
	  if var.invm  =  4 and var.btco  =  2 then  	   	   
	   	  var.secu  =  Activities.secu  
	   	  var.prss  =  Activities.prss  
	   	  var.rtse.1  =  Activities.rtse  
	   	  var.rtse.2  =  0.000001  
	   	  var.rtse.3  =  0.000001  
	   	  var.rfse.1  =  Activities.rfse  
	   	  var.rfse.2  =  1  
	   	  var.rfse.3  =  1  
	   	  var.prin  =  Activities.prin  
	   	  '  |  Determine field 'Progress for Invoice'  
	   	  if var.prin  =  3 then  
	   	   	  var.cspt  =  2 '  |  Indirect  
	   	  end if  
	   	  '  |  Determine field 'To Be Settled'  
	   	  if var.prin  =  1 and var.cspt  =  1 then  
	   	   	  var.setl  =  Activities.setl  
	   	  end if  
	   	  if var.prin  =  2 and var.cspt  =  1 then  
	   	   	  var.setl  =  Activities.setl  
	   	  end if  
	   	  '  |  Determine field 'Group Indirect Work'  
	   	  if var.prin  =  1 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	   	  if var.prin  =  2 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	   	  if var.prin  =  3 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	  end if  
	  '  |  In case Actual Finish Date is filled the Actual Start Date must be empty  !   
	  var.asdt  =  Activities.asdt  
	  if trim(Activities.afdt)  <>  "" then  
	   	  var.asdt  =  ""  
	  end if  
	  dump 01  	  '  |   *  tppss200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:S
:QURY:START
select Activities.*
from Activities
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pss
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ActivityBaseline
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pss
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ActivityBaseline
:ICOD:S
:QURY:START
select ActivityBaseline.*
from ActivityBaseline
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tp
:TCMOD:pss
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ActivityBaseline
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:D
:QURY:START
	  if Texts.TextID  <>  "NULL" then  
	   	  TextLength  =  len(Texts.Text )  
	   	  TextNumber  =  Texts.TextID  
	   	  TextSequence  =  1  
	   	  HEXcode  =  Right("00000000"  &  Hex(TextNumber), 8)  
	   	  for p  =  1 To 7 Step 2  
	   	   	  VarTextNumber  =  VarTextNumber  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	  next  
	   	  HEXcode  =  right ( "00000000"  &  HEX ( TextSequence ) , 8 )  
	   	  for p  =  1 to 7 Step 2  
	   	   	  VarTextSequence  =  VarTextSequence  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	  next  
	   	  i  =  1  
	   	  PrevPos  =  i  
	   	  NumOfCharacters  =  0  
	   	  Do while i  <=  TextLength  
	   	   	  '  |  TextBox needs to be split in multiple text lines  
	   	   	  TextCharacter  =  MID(Texts.Text ,i,1)  
	   	   	  if (NumOfCharacters  >=  240) then  
	   	   	   	  '  |  Create current text as a sequence line.  
	   	   	   	  TextString  =  TextString  +  EndTextString  
	   	   	   	  dump 1  	  '  |   **  TTTXT010  	   
	   	   	   	   
	   	   	   	  '  |  reset fields for next text sequence line.  
	   	   	   	  TextString  =  ""  	   	   	   
	   	   	   	  VarTextNumber  =  ""  	   	   	   
	   	   	   	  VarTextSequence  =  ""  	   	   
	   	   	   	  TextSequence  =  TextSequence  +  1  
	   	   	   	  PrevPos  =  i  
	   	   	   	  NumOfCharacters  =  0  
	   	   	   	   
	   	   	   	  HEXcode  =  Right("00000000"  &  Hex(TextNumber), 8)  
	   	   	   	  for p  =  1 To 7 Step 2  
	   	   	   	   	  VarTextNumber  =  VarTextNumber  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	   	   	  next  
	   	   	   	  HEXcode  =  right ( "00000000"  &  HEX ( TextSequence ) , 8 )  
	   	   	   	  for p  =  1 to 7 Step 2  
	   	   	   	   	  VarTextSequence  =  VarTextSequence  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	   	   	  next  
	   	   	  end if  
	   	   
	   	   	   
	   	   	  '  |  Check for Enter in text  
	   	   	  if (ASC (TextCharacter)  =  13) then  
	   	   	   	  TextCharacter  =  CHR(10)  	   	   	   
	   	   	   	  i  =  i  +  2  
	   	   	  else  
	   	   	   	  TextCharacter  =  TextCharacter  	   	   
	   	   	   	  i  =  i  +  1  
	   	   	  end if  
	   	   	  '  |  Check for TAB in text  
	   	   	  if (ASC (TextCharacter)  =  9) then  
	   	   	   	  CHRspace  =  CHR (32)  
	   	   	   	  TextCharacter  =  ""  	   	   	   	   	   	   	   
	   	   	   	  for p  =  1 to 6  	   	  '  |  Replace TAB with 6 spaces  	   	   	   	   
	   	   	   	   	  TextCharacter  =  TextCharacter  +  CHRspace  	   	   	   
	   	   	   	  next  	   
	   	   	   	  NumOfCharacters  =  NumOfCharacters  +  5  	   	   	   	   	   
	   	   	  end if  	   
	   	   	  TextString  =  TextString  +  TextCharacter  
	   	   	  NumOfCharacters  =  NumOfCharacters  +  1  
	   	  loop  
	   	   
	   	  '  |  Text line is maximum of 239 and fits in 1 text line  
	   	  if TextLength MOD 240  <>  0 then  	   	   	   	   	   	  '  |   #  1948726.sn  
	   	   	   	  TextString  =  TextString  +  CHR (10) '  |  Close Character of the string  
	   	  end if  	   	   	   	   	   	   	   	   	  '  |   #  1948726.en  	   	   
	   	   	   	   	   
	   	  '  |  Fill up the remainder of the string with spaces  
	   	  '  |  240  =  NumOfCharacters  +  Close chararter  +  NrOfSpaces  
	   	  NrOfSpaces  =  239  -  NumOfCharacters  	   	   	   	   
	   	  CHRspace  =  CHR ( 32 )  	   	   	   	   	   	   	   	   	   
	   	  for p  =  1 to NrOfSpaces  	   	   	   	   	   	   	   	   
	   	   	  TextString  =  TextString  +  CHRspace  	   	   	   	   
	   	  next  	   	   	   	   	   	   	   	   
	   	   	   	   	   	   	   	   
	   	  TextString  =  TextString  +  EndTextString  
	   	   
	   	  dump 1  	   	  '  |   **  TTTXT010  
	   	  TextString  =  ""  	   	   	   	   	   	   	   
	   	  VarTextNumber  =  ""  	   	   	   	   	   	   	   
	   	  VarTextSequence  =  ""  	   	   	   	   	   	   
	   	  dump 2  	   	  '  |   **  TTTXT002  
	   	  dump 3  	   	  '  |   **  TTTXT001  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:S
:QURY:START
select  	  Texts.*
from 	  Texts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:D
:QURY:START
	  var.whltc100.ldat  =  LotsByItem.LotDate  
	  if var.whltc100.ldat  =  "" or IsNull(var.whltc100.ldat) then  
	   	  var.whltc100.ldat  =  Date()  
	  end if  
	  dump 100 '  |  Lots
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:S
:QURY:START
select  	  LotsByItem.*
from 	  LotsByItem
order by LotsByItem.Project, LotsByItem.Item, LotsByItem.Lot
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:D
:QURY:START
	  varstr.cprj  =  WarehouseItem.Project  
	  varstr.item  =  WarehouseItem.Item  
	  var.whwmd210.ialt  =  20  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select Items.LocationControlled  
	   	  from Items  
	   	  where Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  If Items.Project  =  "" or IsNull(Items.Project) then  
	   	   	   	  If Items.LocationControlled  =  1 then  
	   	   	   	   	  var.whwmd210.ialt  =  5  
	   	   	   	  else  
	   	   	   	   	  var.whwmd210.ialt  =  20  
	   	   	   	  End If  
	   	   	  End If  
	   	  endselect  
	  else  
	   	  select Items.LocationControlled  
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj  
	   	  and  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  if Items.LocationControlled  =  1 then  
	   	   	   	  var.whwmd210.ialt  =  5  
	   	   	  else  
	   	   	   	  var.whwmd210.ialt  =  20  
	   	   	  end if  
	   	  endselect  
	  end if  
	   
	  if (WarehouseItem.OrderQuantityIncrement  <=  "0") then  
	   	  var.oqmf  =  1  
	  else  
	   	  var.oqmf  =  WarehouseItem.OrderQuantityIncrement  
	  end if  
	  if (WarehouseItem.MinimumOrderQuantity  <=  "0") then  
	   	  var.mioq  =  1  
	  else  
	   	  var.mioq  =  WarehouseItem.MinimumOrderQuantity  
	  end if  
	  if (WarehouseItem.MaximumOrderQuantity  <=  "0") then  
	   	  var.maoq  =  9999999  
	  else  
	   	  var.maoq  =  WarehouseItem.MaximumOrderQuantity  
	  end if  
	  if (WarehouseItem.FixedOrderQuantity  <=  "0") then  
	   	  var.fioq  =  1  
	  else  
	   	  var.fioq  =  WarehouseItem.FixedOrderQuantity  
	  end if  
'  	  if (Warehouse_Item.EconomicOrderQuantity  <=  "0") then  	   |   #  253844.so  
'  	   	  var.ecoq  =  1  
'  	  else  
'  	   	  var.ecoq  =  Warehouse_Item.EconomicOrderQuantity  
'  	  end if  	   	   	   	   	   	   	   |   #  253844.eo  
	  if (WarehouseItem.EconomicOrderQuantity  <=  "0") then  	  '  |   #  253844.sn  
	   	  var.ecoq  =  1  
	  else  
	   	  var.ecoq  =  WarehouseItem.EconomicOrderQuantity  
	  end if  
	   	   	   	   	   	   	  '  |   #  253844.en  
	  var.whwmd210.srpr  =  2  
	  if (WarehouseItem.InventoryValuationMethod)  =  6 then  
	   	  var.whwmd210.srpr  =  1  
	  end if  
	  dump 210  	  '  |   *  whwmd210  -  Warehouse Item Data  
	  dump 215  	  '  |   *  whwmd215  -  Item Inv by Warehouse  
	  dump 216  	  '  |   *  whwmd216  -  Inv by warehouse, item , eff unit
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:S
:QURY:START
select  	  WarehouseItem.*
from 	  WarehouseItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:wh
:TCMOD:wmd
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DockLocationsByWarehouseStorageZone
:ICOD:D
:QURY:START
'  |   	  Call DetermineShipFromToBusinessPartner(_  	   	   	  '  |   #  249610.so  
'  |   	   	  DockLocationsByWarehouseStorageZone.DockType,_  
'  |   	   	  DockLocationsByWarehouseStorageZone.BusinessPartner)  
	   	   	   	   	   	   	   	   	  '  |   #  249610.eo  
'  |  KH20110804.so  
'  |   	   	   	   	   	   	   	   	   	  '  |   #  249610.sn  
'  |   	  Call DetermineShipFromToBusinessPartner(_  
'  |   	   	  DockLocationsByWarehouseStorageZone.DockType,_  
'  |   	   	  DockLocationsByWarehouseStorageZone.BusinessPartner,_  
'  |   	   	  var.whwmd220.sfty,_  
'  |   	   	  var.whwmd220.sfco,_  
'  |   	   	  var.whwmd220.stty,_  	   
'  |   	   	  var.whwmd220.stco)  
'  |   	   	   	   	   	   	   	   	   	  '  |   #  249610.en  
'  |  KH20110804.eo.sn  
	  '  |  initialize  
	  var.whwmd220.sfty  =  10  	   	  '  |  Not aplicable  
	  var.whwmd220.sfco  =  ""  
	  var.whwmd220.stty  =  10  	   	  '  |  Not aplicable  
	  var.whwmd220.stco  =  ""  
	  varstr.DockType  =  DockLocationsByWarehouseStorageZone.DockType  
	  varstr.BusinessPartner  =  DockLocationsByWarehouseStorageZone.BusinessPartner  
	  If Trim(varstr.BusinessPartner)  <>  "" then  
	   	  If varstr.DockType  =  3 then  	   	  '  |  Receiving  
	   	   	  var.whwmd220.sfty  =  2  	   	   	   	   	  '  |  Business Partner  
	   	   	  var.whwmd220.sfco  =  Trim(varstr.BusinessPartner)  
	   	   	  var.whwmd220.stty  =  10  	   	   	   	   	  '  |  Not aplicable  	   
	   	   	  var.whwmd220.stco  =  ""  	   
	   	  End If  
	   	  If varstr.DockType  =  6 then  	   	  '  |  Staging  
	   	   	  var.whwmd220.sfty  =  10  	   	   	   	   	  '  |  Not aplicable  	   	   	   
	   	   	  var.whwmd220.sfco  =  ""  
	   	   	  var.whwmd220.stty  =  2  	   	   	   	   	  '  |  Business Partner  	   
	   	   	  var.whwmd220.stco  =  Trim(varstr.BusinessPartner)  	   
	   	  End If  
	  End If  
'  |  KH.en  
dump 220
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:wh
:TCMOD:wmd
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DockLocationsByWarehouseStorageZone
:ICOD:S
:QURY:START
select DockLocationsByWarehouseStorageZone.*
from DockLocationsByWarehouseStorageZone
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:wh
:TCMOD:wmd
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:DockLocationsByWarehouseStorageZone
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:wh
:TCMOD:wmd
:TFLNO:310
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Zones
:ICOD:D
:QURY:START
dump 310
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:wh
:TCMOD:wmd
:TFLNO:310
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Zones
:ICOD:S
:QURY:START
select Zones.*
from Zones
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:11
:VERS:A2LN
:RELE:LN
:CUST:105
:TCPAC:wh
:TCMOD:wmd
:TFLNO:310
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Zones
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:D
:QURY:START
	  varstr.bp  =  BusinessPartner.BusinessPartner  
	  CustomerRoles  =  0  
	  SupplierRoles  =  0  
	  if BusinessPartner.SearchKey  <>  "" then  
	   	  var.tccom100.seak  =  UCase(Left(BusinessPartner.SearchKey,16))  
	  else  
	   	  var.tccom100.seak  =  UCase(Left(BusinessPartner.Name,16))  
	  end if  
	  var.tccom100.stdt  =  get.utc(BusinessPartner.StartDate, "no")  
	  if BusinessPartner.SoldTo  =  1 then  
	   	  CustomerRoles  =  1  
	   	  dump 110 '  |   #  tccom110  
	  end if  
	  if BusinessPartner.ShipTo  =  1 then  
	   	  if Trim(BusinessPartner.ShipToAddress)  <>  "" then  
	   	   	  varstr.address  =  BusinessPartner.ShipToAddress  
	   	  else  
	   	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  end if  
	   	  CustomerRoles  =  1  
	   	  dump 111 '  |   #  tccom111  
	  end if  
	  if BusinessPartner.InvoiceTo  =  1 then  
	   	  if Trim(BusinessPartner.InvoiceToAddress)  <>  "" then  
	   	   	  varstr.address  =  BusinessPartner.InvoiceToAddress  
	   	  else  
	   	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  end if  
	   	  CustomerRoles  =  1  
	   	  var.tccom112.edci  =  get.utc(BusinessPartner.ExpiryDateInsuredCredit,"no")  
	   	  dump 112 '  |   #  tccom112  
	  end if  
	  if BusinessPartner.PayBy  =  1 then  
	   	  CustomerRoles  =  1  
'  |  243210.sn  
	   	  var.tccom114.cban  =  ""  
	   	  select BankAccountsByPayByBP.*   
	   	  from BankAccountsByPayByBP  
	   	  where BankAccountsByPayByBP.PayByBusinessPartner  =  varstr.bp  
	   	  order by BankAccountsByPayByBP.BankAccountCode desc  
	   	  selectdo  
	   	   	  var.tccom114.cban  =  BankAccountsByPayByBP.BankAccountCode  
	   	  endselect  
'  |  243210.en  
	   	  dump 114 '  |   #  tccom114  
	  end if  
	  if BusinessPartner.BuyFrom  =  1 then  
	   	  SupplierRoles  =  1  
	   	  dump 120 '  |   #  tccom120  
	  end if  
	  if BusinessPartner.ShipFrom  =  1 then  
	   	  SupplierRoles  =  1  
	   	  dump 121 '  |   #  tccom121  
	  end if  
	  if BusinessPartner.InvoiceFrom  =  1 then  
	   	  SupplierRoles  =  1  
'  |  FP7.sn  	   	   
	   	  var.tccom122.cadr  =  BusinessPartner.AddressCode  
	   	  var.tccom122.rtyp  =  BusinessPartner.ExchangeRateType  
	   	  var.tccom122.crlr  =  BusinessPartner.CreditLimit  
	   	  if Not IsNull(BusinessPartner.CreditLimit) then  
	   	   	  var.tccom122.crlr  =  BusinessPartner.CreditLimit  
	   	  else  
	   	   	  var.tccom122.crlr  =  0.0  
	   	  end if  	   	   	   
	   	  var.tccom122.cpay  =  BusinessPartner.TermsPayment  
	   	  var.tccom122.ccrs  =  BusinessPartner.LatePaymentSurcharge  
	   	  var.tccom122.paym  =  BusinessPartner.PaymentMethod  
	   	  varstr.businesspartner  =  BusinessPartner.BusinessPartner  
	   	  select BusinessPartnerExtension.*   
	   	  from BusinessPartnerExtension  
	   	  where BusinessPartnerExtension.BusinessPartner  =  varstr.businesspartner  
	   	  selectdo  
	   	   	  if BusinessPartnerExtension.AddressCodeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.cadr  =  BusinessPartnerExtension.AddressCodeInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.ExchangeRateTypeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.rtyp  =  BusinessPartnerExtension.ExchangeRateTypeInvFrom  
	   	   	  end if  	   	   
	   	   	  if Not IsNull(BusinessPartnerExtension.CreditLimitInvFrom) then  
	   	   	   	  var.tccom122.crlr  =  BusinessPartnerExtension.CreditLimitInvFrom  
	   	   	  end if  	   	   
	   	   	  if BusinessPartnerExtension.TermsPaymentInvFrom  <>  "" then  
	   	   	   	  var.tccom122.cpay  =  BusinessPartnerExtension.TermsPaymentInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.LatePaymentSurchargeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.ccrs  =  BusinessPartnerExtension.LatePaymentSurchargeInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.PaymentMethodInvFrom  <>  "" then  
	   	   	   	  var.tccom122.paym  =  BusinessPartnerExtension.PaymentMethodInvFrom  
	   	   	  end if  
	   	  endselect  
|  FP7.en  
	   	  dump 122 '  |   #  tccom122  
	  end if  
	  if BusinessPartner.PayTo  =  1 then  
	   	  SupplierRoles  =  1  
'  |   *  Determine Bank Code  
'  |   *   #  42.sn  
	   	  var.tccom124.cban  =  ""  
	   	  select BankAccountsByPayToBP.*   
	   	  from  	  BankAccountsByPayToBP  
	   	  where BankAccountsByPayToBP.PayToBusinessPartner  =  varstr.bp  
	   	  order by BankAccountsByPayToBP.BankAccountCode desc  
	   	  selectdo  
	   	   	  var.tccom124.cban  =  BankAccountsByPayToBP.BankAccountCode  
	   	  endselect  
'  |   *   #  42.en  
	   	  dump 124 '  |   #  tccom124  
	  end if  
	  if CustomerRoles  =  0 then  
	   	  if SupplierRoles  =  0 then  
	   	   	  var.tccom100.bprl  =  1  
	   	  else  
	   	   	  var.tccom100.bprl  =  3  
	   	  end if  
	  else  
	   	  if SupplierRoles  =  0 then  
	   	   	  var.tccom100.bprl  =  2  
	   	  else  
	   	   	  var.tccom100.bprl  =  4  
	   	  end if  
	  end if  
	  dump 100 '  |   #  tccom100  
	  If BusinessPartner.TaxNumber  <>  "" then  
	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  var.tctax400.ccty  =  ""  
	   	  select  	  Addresses.*   
	   	  from  	  Addresses  
	   	  where  	  Addresses.AddressCode  =  varstr.address  
	   	  selectdo  
	   	   	  var.tctax400.ccty  =  Addresses.Country  
	   	  endselect  
	   	  dump 400 '  |   #  tctax400  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:S
:QURY:START
select  	  BusinessPartner.*
from 	  BusinessPartner
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:D
:QURY:START
	  if Addresses.SearchKey  <>  "" then  
	   	  var.tccom130.seak  =  Ucase(Left(Addresses.SearchKey,16))  
	  else  
	   	  var.tccom130.seak  =  Ucase(Left(Addresses.Name,16))  
	  end if  
'  |  Determine default messaging method  
'  |  SITA not used  
	  var.tccom130.defa  =  10  
'target(tccom.defa.not.applicable)  
	  if Addresses.SMSNumber  <>  "" then  
	   	  var.tccom130.defa  =  5 'to.target(tccom.defa.sms)  
	  end if  
	  if Addresses.Telex  <>  "" then  
	   	  var.tccom130.defa  =  3 ' to.target(tccom.defa.telex)  
	  end if  
	  if Addresses.Fax  <>  "" then  
	   	  var.tccom130.defa  =  2' to.target(tccom.defa.fax)  
	  end if  
	  if Addresses.Email  <>  "" then  
	   	  var.tccom130.defa  =  1 ' to.target(tccom.defa.email)  
	  end if  
	  if len(trim(Addresses.Telephone))  >  0 then  
	   	  var.tccom130.defa  =  6 ' to.target(tccom.defa.phone)  
	  end if  
'  |  end determine defa  
	  If Addresses.GPSLatitude  <>  "" then  	   	   	   	   	   	  'LN1052.sn  
	   	  var.tccom130.glat  =  Addresses.GPSLatitude  
	  else  
	   	  var.tccom130.glat  =  0  
	  end if  	   	   	   	   	   	   	   	   	   	   
	  If Addresses.GPSLongitude  <>  "" then  	   	   	   	   	   
	   	  var.tccom130.glon  =  Addresses.GPSLongitude  
	  else  
	   	  var.tccom130.glon  =  0  
	  end if  	   	   	   	   	   	   	   	   	   	  'LN1052.en  
	  dump 130 '  |   #  tccom130  
'  
	  if len(trim(Addresses.ZipPostalCode))  >  0 then  
	   	  if var.country  <>  trim(Addresses.Country) or _  
	   	  var.zipcode  <>  trim(Addresses.ZipPostalCode) then  
	   	   	  var.country  =  trim(Addresses.Country)  
	   	   	  var.zipcode  =  trim(Addresses.ZipPostalCode)  
	   	   	  dump 136 '  |   #  tccom136  
	   	  end if  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:S
:QURY:START
select Addresses.*
from Addresses
order by Addresses.Country, Addresses.ZipPostalCode
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:D
:QURY:START
'  |   **********************************************************************************************   
'  |  Function Flow  
'  |  1  -  Setting of some global variables.  
'  |  2  -  For each dump table  
'  |   	   	  a  -  Handle defaulting fields not in the item access table  
'  |   	   	  b  -  Handle defaulting fields als in item access table  
'  |   	   	  c  -  All other variables for the dump table are set.  
'  |   	   	  Based upon specific values in the Item Access table a variable is set which is  
'  |   	   	  used in the dumps.  
'  |  3  -  Dump section for all tables.  
'  |   	   
'  |   **********************************************************************************************   
	  varstr.cprj  	   	   =  Items.Project  
	  varstr.item  	   	   =  Items.Item  
	  varstr.itemgroup  	   =  Items.ItemGroup  	   	   	   	   
	  varint.itemtype  	   =  Items.ItemType  
	  if Items.Exception  =  0 then  
	   	  Items.Exception  =  1  
	  end if  	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for General Data (tcibd001)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsGeneral.*   
	  from  	   	  ItemDefaultsGeneral  
	  where  	   	  ItemDefaultsGeneral.kitm  =  varint.itemtype And ItemDefaultsGeneral.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tcibd001.ccfg  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ccfg, "", Items.Exception, DefaultFound)  	  'LN10_4.n  
	  var.tcibd001.exin  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.exin, "", Items.Exception, DefaultFound)  
	   
	  var.tcibd001.chma  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.chma, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.cnfg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.cnfg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.coeu  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.coeu, 0, Items.Exception, DefaultFound, 2)  	  'LN1052.n  
	  var.tcibd001.dpcr  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpcr, 0, Items.Exception, DefaultFound, 100)  
	  var.tcibd001.dpeg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpeg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.dptp  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dptp, 0, Items.Exception, DefaultFound, 90)  
	  var.tcibd001.dpuu  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpuu, 0, Items.Exception, DefaultFound, 2)  	   	   
	  var.tcibd001.edco  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.edco, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.eitm  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.eitm, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.icsi  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.icsi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tcibd001.itmt  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.itmt, 0, Items.Exception, DefaultFound, 10)  
	  var.tcibd001.ippg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ippg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.mcoa  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.mcoa, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.opol  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.opol, 0, Items.Exception, DefaultFound, 2)  	  'LN1052.n  
	  var.tcibd001.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.osys, 0, Items.Exception, DefaultFound, 2)  	  'LN1052.n  
	  var.tcibd001.ppeg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ppeg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.psiu  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.psiu, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.sayn  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.sayn, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.styp  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.styp, 0, Items.Exception, DefaultFound, 1)  
	  var.tcibd001.subc  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.subc, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.wpcs  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.wpcs, 0, Items.Exception, DefaultFound, 2)  	  'LN1052.n  
	   
	  'Defaults presents and present in Item access table  
	  var.tcibd001.ccde  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ccde, Items.CommodityCode, Items.Exception, DefaultFound)  
	  var.tcibd001.cean  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cean, Items.EANCode, Items.Exception, DefaultFound)  
	  var.tcibd001.cmnf  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cmnf, Items.Manufacturer, Items.Exception, DefaultFound)  
	  var.tcibd001.cood  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cood, Items.TechnicalCoordinator, Items.Exception, DefaultFound)  
	  var.tcibd001.cpcl  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpcl, Items.ProductClass, Items.Exception, DefaultFound)  
	  var.tcibd001.cpcp  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpcp, Items.CostComponent, Items.Exception, DefaultFound)  
	  var.tcibd001.cpln  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpln, Items.ProductLine, Items.Exception, DefaultFound)  
	  var.tcibd001.csel  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.csel, Items.SelectionCode, Items.Exception, DefaultFound)  
	  var.tcibd001.csig  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.csig, Items.ItemSignal, Items.Exception, DefaultFound)  
	  var.tcibd001.ctyo  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ctyo, Items.CountryOrigin, Items.Exception, DefaultFound)  
	  var.tcibd001.ctyp  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ctyp, Items.ProductType, Items.Exception, DefaultFound)  
	  var.tcibd001.cuni  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cuni, Items.InventoryUnit, Items.Exception, DefaultFound)  
	  var.tcibd001.dscb  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscb, Items.Material, Items.Exception, DefaultFound)  
	  var.tcibd001.dscc  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscc, Items.Size, Items.Exception, DefaultFound)  
	  var.tcibd001.dscd  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscd, Items.Standard, Items.Exception, DefaultFound)  
	  var.tcibd001.uset  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.uset, Items.UnitSet, Items.Exception, DefaultFound)  
	  var.tcibd001.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.txta, Items.TextIDGeneral, Items.Exception, DefaultFound)  
	  if Items.WeightUnit  =  "" then  
	   	  var.tcibd001.cwun  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cwun, var.weight.unit, Items.Exception, DefaultFound)  
	   	  var.tcibd001.wght  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.wght, 0, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd001.cwun  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cwun, Items.WeightUnit, Items.Exception, DefaultFound)  
	   	  var.tcibd001.wght  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.wght, Items.Weight, Items.Exception, DefaultFound)  
	  end if  
	  var.tcibd001.srce  =  DetermineSrce(Items.ItemType)  
	  var.tcibd001.srce  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.srce, var.tcibd001.srce, Items.Exception,DefaultFound, 10)  
'  |   **********************************************************************************************   
'  |  In case of Lot Controlled (tcibd001)  	   	   
'  |   **********************************************************************************************   
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tcibd001.ltct  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ltct, Items.LotControlled, Items.Exception, DefaultFound, 2)  
	  else  
	   	  var.tcibd001.ltct  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ltct, 2, Items.Exception, DefaultFound, 2)  
	  end if  
	   
'  |   **********************************************************************************************   
'  |  In case of Serialized Items (tcibd001)  
'  |   **********************************************************************************************   
	  If Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tcibd001.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.seri, Items.Serialized, Items.Exception, DefaultFound, 2)  	   
	  else  
	   	  var.tcibd001.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.seri, 2, Items.Exception, DefaultFound, 2)  	   	   
	  end if  
	   	   
'  |   **********************************************************************************************   
'  |  Settings for General Item data (tcibd001)  
'  |   **********************************************************************************************   
	  if Items.SearchKeyI  <>  "" then  
	   	  var.tcibd001.seak  =  UCase(Left(Items.SearchKeyI, 16))  
	  else  
	   	  var.tcibd001.seak  =  UCase(Left(Items.ItemDescription, 16))  
	  end if  
	   
	  if Items.SearchKeyII  <>  "" then  
	   	  var.tcibd001.seab  =  UCase(Left(Items.SearchKeyII, 16))  
	  else  
	   	  var.tcibd001.seab  =  UCase(Left(Items.Item, 16))  
	  end if  
	   
'  |   **********************************************************************************************   
'  |  Settings for Alternative Items (tcibd001)  
'  |   **********************************************************************************************   
	  var.tcibd001.repl  =  5  	   	   	   	   	   	  '  |  Not Applicable  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where ( AlternativeItems.Project  =  "" and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  10  	   	   	   	  '  |  Replaced  
	   	  endselect  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  "" and AlternativeItems.AlternativeItem  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  15  	   	   	   	  '  |  Substitute  
	   	  endselect  
	  else  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  varstr.cprj and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  10  	   	   	   	  '  |  Replaced  
	   	  endselect  
	  end if  
	   
	   
	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Costing Data (ticpr007)  
'  |   **********************************************************************************************   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsCosting.*   
	  from  	  ItemDefaultsCosting  
	  where  	  ItemDefaultsCosting.kitm  =  varint.itemtype And ItemDefaultsCosting.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.ticpr007.chrt  =  ItemHandling.GetTypeString(ItemDefaultsCosting.chrt, "", Items.Exception, DefaultFound)  	   
	  var.ticpr007.lcst  =  ItemHandling.GetTypeString(ItemDefaultsCosting.lcst, "", Items.Exception, DefaultFound)  
	  var.tcibd007.inlc  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.inlc, 0, Items.Exception, DefaultFound, 2)  
	   
	  'Defaults presents and present in Item access table  
'  	  var.tcibd007.acpm  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpm, Items.AggregatedMaterialCostCompo, Items.Exception, DefaultFound)  	   	   |   #  LN1060.o  
	  var.tcibd007.ccur  =  ItemHandling.GetTypeString(ItemDefaultsCosting.ccur, Items.CostingCurrency, Items.Exception, DefaultFound)  
	  var.tcibd007.spit  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.spit, Items.SurchargesbyItem, Items.Exception, DefaultFound, 2)  
	  var.tcibd007.vpwh  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.vpwh, Items.SurchargesbyWarehouse, Items.Exception, DefaultFound, 2)  
	   
'  	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  	   	   	   	   	   	   	   	   |   #  LN1060.so  
'  	   	  var.tcibd007.acpo  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpo, Items.AggregatedOperationCostComp, Items.Exception, DefaultFound)  
'  	   	  var.tcibd007.acps  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acps, Items.AggregatedSurchargeCostComp, Items.Exception, DefaultFound)  
'  	  else  
'  	   	  var.tcibd007.acpo  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpo, "", Items.Exception, DefaultFound)  
'  	   	  var.tcibd007.acps  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acps, "", Items.Exception, DefaultFound)  
'  	  end if  	   	   	   	   	   	   	   	   	   	   	   	   	   	   	   |   #  LN1060.eo  
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Purchase Data (tdipu001)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsPurchase.*   
	  from  	  ItemDefaultsPurchase  
	  where  	  ItemDefaultsPurchase.kitm  =  varint.itemtype And ItemDefaultsPurchase.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  	   
	   
	  'Defaults presents but not in Item access table  	   
	  var.tdipu001.cncd  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cncd, "", Items.Exception, DefaultFound)  	  'LN10_4.n  
	   
	  var.tdipu001.lcmp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.lcmp, 0, Items.Exception, DefaultFound)  	  'LN1052.n  
	  var.tdipu001.rtdm  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtdm, 0, Items.Exception, DefaultFound)  
	  var.tdipu001.rtdp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtdp, 0, Items.Exception, DefaultFound)  	   
	  var.tdipu001.rtqm  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtqm, 0, Items.Exception, DefaultFound)  
	  var.tdipu001.rtqp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtqp, 0, Items.Exception, DefaultFound)  
	   
	  var.tdipu001.acci  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.acci, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.casl  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.casl, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.cims  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.cims, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.hstq  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.hstq, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.hstd  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.hstd, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.issp  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.issp, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.mmnf  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.mmnf, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.mpyn  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.mpyn, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tdipu001.rqms  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.rqms, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.rmss  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.rmss, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tdipu001.qual  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.qual, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.scus  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.scus, 0, Items.Exception, DefaultFound, 2)  	  'LN1052.n  
	  var.tdipu001.styp  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.styp, 0, Items.Exception, DefaultFound, 2)  	  'LN1052.n  
	  var.tdipu001.vryn  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.vryn, 0, Items.Exception, DefaultFound, 1)  
	   
	  'Defaults presents and present in Item access table  
	  var.tdipu001.buyr  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.buyr, Items.Buyer, Items.Exception, DefaultFound)  
	  var.tdipu001.ccur  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.ccur, Items.PurchaseCurrency, Items.Exception, DefaultFound)  
	  var.tdipu001.cofc  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cofc, Items.PurchaseOffice, Items.Exception, DefaultFound)  
	  var.tdipu001.cpgp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cpgp, Items.PurchasePriceGroup, Items.Exception, DefaultFound)  
	  var.tdipu001.csgp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.csgp, Items.PurchaseStatisticsGroup, Items.Exception, DefaultFound)  
	  var.tdipu001.cupp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cupp, Items.PurchasePriceUnit, Items.Exception, DefaultFound)  
	  var.tdipu001.cuqp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cuqp, Items.PurchaseUnit, Items.Exception, DefaultFound)  
	  var.tdipu001.cvat  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cvat, Items.TaxCodePurchase, Items.Exception, DefaultFound)  
	  var.tdipu001.otbp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.otbp, Items.BuyFromBusinessPartner, Items.Exception, DefaultFound)  
	  var.tdipu001.txtp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.txtp, Items.TextIDPurchase, Items.Exception, DefaultFound)  
	   
	  If Items.ItemType  =  4 then  
	   	  var.tdipu001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.retw, 2, Items.Exception, DefaultFound, 1)  
	   	  var.tdipu001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cwar, "", Items.Exception, DefaultFound)  
	  else  
	   	  var.tdipu001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.retw, 1, Items.Exception, DefaultFound, 1)  
	   	  var.tdipu001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cwar, Items.Warehouse, Items.Exception, DefaultFound)  
	  end if  
	   
	  If Items.SupplyTime  <  "0" then  
	   	  'Set value to zero in case it is smaller than zero  
	   	  var.tdipu001.suti  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.suti, 0, Items.Exception, DefaultFound)  	   
	  else  	   
	   	  var.tdipu001.suti  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.suti, Items.SupplyTime, Items.Exception, DefaultFound)  	   
	  end if  
	   
	  If Items.UnitforSupplyTime  =  "" then  
	   	  ' Set access value to 10 in case it is empty  
	   	  var.tdipu001.sutu  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sutu, 10, Items.Exception, DefaultFound, 10)  
	  Else  
	   	  var.tdipu001.sutu  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sutu, Items.UnitforSupplyTime, Items.Exception, DefaultFound, 10)  	   
	  End If  
	  var.tdipu001.sopr  =  set.source.of.price(Items.ItemType)  	  '  |  Fp9.n  
	  var.tdipu001.sopr  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sopr, var.tdipu001.sopr, Items.Exception, DefaultFound, 3)  
	   	   	   	   	   	   	   	   	   	   	  'LN10_4.sn  
	  var.tdipu001.sops  =  set.source.of.price.for.service.subcontracting(Items.ItemType)  
	  var.tdipu001.sops  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sopr, var.tdipu001.sops, Items.Exception, DefaultFound, 3)  
	   
	  var.tdipu001.prip  =  get.purchase.price(Items.ItemType, Items.PurchasePrice)  
	   	   	   	   	   	   	   	   	   	   	  'LN10_4.en  
	   
	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Sales Data (tdisa001)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsSales.*   
	  from  	  ItemDefaultsSales  
	  where  	  ItemDefaultsSales.kitm  =  varint.itemtype And ItemDefaultsSales.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tdisa001.lmsp  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.lmsp, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.mnra  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.mnra, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.mmtl  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.mmtl, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.qidd  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qidd, 9999999.99, Items.Exception, DefaultFound)  
	  var.tdisa001.qimc  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qimc, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.qimo  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qimo, 1, Items.Exception, DefaultFound)  
	  var.tdisa001.umsp  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.umsp, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.cncd  =  ItemHandling.GetTypeString(ItemDefaultsSales.cncd, "", Items.Exception, DefaultFound)  
	  var.tdisa001.cmgp  =  ItemHandling.GetTypeString(ItemDefaultsSales.cmgp, "", Items.Exception, DefaultFound)  
	  var.tdisa001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsSales.cwar, "", Items.Exception, DefaultFound)  
	  var.tdisa001.rbgp  =  ItemHandling.GetTypeString(ItemDefaultsSales.rbgp, "", Items.Exception, DefaultFound)  
	   
	  var.tdisa001.acci  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.acci, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.acom  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.acom, 0, Items.Exception, DefaultFound, 1)  
	  var.tdisa001.actn  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.actn, 0, Items.Exception, DefaultFound, 3)  
	  var.tdisa001.alod  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.alod, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.cphl  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.chpl, 0, Items.Exception, DefaultFound, 5)  	   
	  var.tdisa001.rcom  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.rcom, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.scon  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.scon, 0, Items.Exception, DefaultFound, 10)  
	  var.tdisa001.tltp  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.tltp, 0, Items.Exception, DefaultFound, 3)  
	  'Defaults presents and present in Item access table  
	  var.tdisa001.cpgs  =  ItemHandling.GetTypeString(ItemDefaultsSales.cpgs, Items.SalesPriceGroup, Items.Exception, DefaultFound)  
	  var.tdisa001.csgs  =  ItemHandling.GetTypeString(ItemDefaultsSales.csgs, Items.SalesStatisticsGroup, Items.Exception, DefaultFound)  
	  var.tdisa001.cups  =  ItemHandling.GetTypeString(ItemDefaultsSales.cups, Items.SalesPriceUnit, Items.Exception, DefaultFound)  
	  var.tdisa001.cuqs  =  ItemHandling.GetTypeString(ItemDefaultsSales.cuqs, Items.SalesUnit, Items.Exception, DefaultFound)  	   
	  var.tdisa001.cvat  =  ItemHandling.GetTypeString(ItemDefaultsSales.cvat, Items.TaxCodeSales, Items.Exception, DefaultFound)  
	  var.tdisa001.txts  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.txts, Items.TextIDSales, Items.Exception, DefaultFound)  
	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	   	  var.tdisa001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.retw, 1, Items.Exception, DefaultFound, 2)  
	  else  
	   	  var.tdisa001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.retw, 2, Items.Exception, DefaultFound, 2)  
	  end if  
	   
'  |   **********************************************************************************************   	   
'  |   *  Setting variables for Item Sales Data (tdisa001)  
'  |   **********************************************************************************************   	   
	  if Items.SalesPrice  <  "0" Then  
	   	  ' minimum price is 0  
	   	  var.tdisa001.pris  =  0  
	  Else  
	   	  var.tdisa001.pris  =  Items.SalesPrice  
	  end if  
	   
	  if Items.SuggestedRetailPrice  <  "0" then  
	   	  ' minimum price is 0  
	   	  var.tdisa001.prir  =  0  
	  Else  
	   	  var.tdisa001.prir  =  Items.SuggestedRetailPrice  
	  end if  
	   
'  |   ********************************************************************************************   
'  |  It default variables for Item Ordering Data (tcibd200)  
'  |   ********************************************************************************************   
	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsOrdering.*   
	  from  	  ItemDefaultsOrdering  
	  where  	  ItemDefaultsOrdering.kitm  =  varint.itemtype And ItemDefaultsOrdering.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tcibd200.auso  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.auso, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.crmp  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.crmp, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.kctr  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.kctr, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.plpl  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.plpl, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tcibd200.ptyp  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.ptyp, 0, Items.Exception, DefaultFound, 3)  	   
	  var.tcibd200.uaoq  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.uaoq, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.wpcs  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.wpcs, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	   
	  var.tcibd200.nopr  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.nopr, 1, Items.Exception, DefaultFound)  
	  var.tcibd200.ocst  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ocst, 0, Items.Exception, DefaultFound)  
	  var.tcibd200.serv  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.serv, 0, Items.Exception, DefaultFound)  
	  var.tcibd200.csps  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.csps, "", Items.Exception, DefaultFound)  
	  var.tcibd200.cspd  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cspd, "", Items.Exception, DefaultFound)  
	  var.tcibd200.cplb  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cplb, "", Items.Exception, DefaultFound)  
	  var.tcibd200.rgrp  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.rgrp, "", Items.Exception, DefaultFound)  
	  var.tcibd200.sfpl  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.sfpl, "", Items.Exception, DefaultFound)  
	  'Defaults presents and present in Item access table  
	  var.tcibd200.cwar  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cwar, Items.Warehouse, Items.Exception, DefaultFound)  	   
	  var.tcibd200.maxs  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maxs, Items.MaximumInventory, Items.Exception, DefaultFound)  	   
	  var.tcibd200.oint  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oint, Items.OrderInterval, Items.Exception, DefaultFound)  
	  var.tcibd200.reop  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.reop, Items.Reorderpoint, Items.Exception, DefaultFound)  
	  var.tcibd200.sftm  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.sftm, Items.SafetyTime, Items.Exception, DefaultFound)  
	  var.tcibd200.sfst  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.sfst, Items.SafetyStock, Items.Exception, DefaultFound)  
	  var.tcibd200.oivu  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.oivu, Items.OrderIntervalUnit, Items.Exception, DefaultFound, 10)  
	  var.tcibd200.omth  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.omth, Items.OrderMethod, Items.Exception, DefaultFound, 1)  
	  var.tcibd200.opol  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.opol, Items.OrderPolicy, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.tuni  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.tuni, Items.SafetyTimeUnit, Items.Exception, DefaultFound, 10)  
	   
	  If Items.OrderSystem  =  4 and Items.ItemType  <>  3 then  
	   	  var.tcibd200.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.osys, 9, Items.Exception, DefaultFound, 9)  
	  else  
	   	  var.tcibd200.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.osys, Items.OrderSystem, Items.Exception, DefaultFound, 9)  
	  end if  
	  if (Items.OrderQuantityIncrement  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.oqmf  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oqmf, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.oqmf  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oqmf, Items.OrderQuantityIncrement, Items.Exception, DefaultFound)  
	  end if  	   
	  if (Items.MinimumOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.mioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.mioq, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.mioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.mioq, Items.MinimumOrderQuantity, Items.Exception, DefaultFound)  
	  end if  
	  if (Items.MaximumOrderQuantity  <=  "0") then  
	   	  var.tcibd200.maoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maoq, 9999999, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tcibd200.maoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maoq, Items.MaximumOrderQuantity, Items.Exception, DefaultFound)  	   	   
	  End if  
	  If (Items.FixedOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.fioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.fioq, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.fioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.fioq, Items.FixedOrderQuantity , Items.Exception, DefaultFound)  	   	   
	  end if  
	   
	  If (Items.EconomicOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.ecoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ecoq, 1, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tcibd200.ecoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ecoq, Items.EconomicOrderQuantity, Items.Exception, DefaultFound)  
	  End if  
'  |   **********************************************************************************************   
'  |  Item default variables for Item Production Data (tiipd001)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsProduction.*   
	  from  	  ItemDefaultsProduction  
	  where  	  ItemDefaultsProduction.kitm  =  varint.itemtype And ItemDefaultsProduction.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.tiipd001.pcrp  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.pcrp, 0, Items.Exception, DefaultFound)  
	  var.tiipd001.scdl  =  ItemHandling.GetTypeString(ItemDefaultsProduction.scdl, "", Items.Exception, DefaultFound)  
	  var.tiipd001.sfpl  =  ItemHandling.GetTypeString(ItemDefaultsProduction.sfpl, "", Items.Exception, DefaultFound)  	   	   |   *  LN1052.n  
	  var.tiipd001.rgrp  =  ItemHandling.GetTypeString(ItemDefaultsProduction.rgrp, "", Items.Exception, DefaultFound)  	   	   |   *  LN1052.n  
	  var.tiipd001.cick  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.cick, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.drin  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.drin, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.dris  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.dris, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.iuma  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.iuma, 0, Items.Exception, DefaultFound, 10)  
	  var.tiipd001.oqdr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oqdr, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.repi  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.repi, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.smfs  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.smfs, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tiipd001.swoc  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.swoc, 0, Items.Exception, DefaultFound, 1)  	   
	   
	  'Defaults presents and present in Item access table  
	  var.tiipd001.cpha  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.cpha, Items.Phantom, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.phst  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.phst, Items.UsePhantomInventory, Items.Exception, DefaultFound, 2)  
	  If Items.BackflushIfMaterial  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfcp  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfcp,2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfcp  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfcp,Items.BackflushIfMaterial, Items.Exception, DefaultFound, 2)  
	  End If  
	  If Items.BackflushMaterials  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfep  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfep,2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfep  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfep,Items.BackflushMaterials, Items.Exception, DefaultFound, 2)  
	  End If  
	  If Items.BackflushHours  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfhr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfhr, 2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfhr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfhr,Items.BackflushHours, Items.Exception, DefaultFound, 2)  
	  End if  
	   	   	   
	  If Items.RoutingQuantity  <=  "0" Then  
	   	  'Minimum value is 1  
	   	  var.tiipd001.runi  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.runi, 1, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.runi  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.runi, Items.RoutingQuantity, Items.Exception, DefaultFound)  	   
	  End if  
	  If Items.BOMQuantity  <=  "0" then  
	   	  'Minimum value is 1  
	   	  var.tiipd001.unom  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.unom, 1, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.tiipd001.unom  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.unom, Items.BOMQuantity, Items.Exception, DefaultFound)  	   	   
	  End if  
	  If Items.ScrapFactor  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.scpf  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpf, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.scpf  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpf, Items.ScrapFactor, Items.Exception, DefaultFound)  
	  End if  
	  If Items.ScrapQuantity  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.scpq  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpq, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.scpq  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpq, Items.ScrapQuantity, Items.Exception, DefaultFound)  
	  End if  
	  If Items.OrderLeadTimeUnit  =  0 Then  
	   	  'If not defined than it will be mapped with hours (5)  
	   	  var.tiipd001.oltu  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oltu, 5 , Items.Exception, DefaultFound, 5)  
	  Else  
	   	  var.tiipd001.oltu  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oltu,Items.OrderLeadTimeUnit, Items.Exception, DefaultFound, 5)  
	  End if  
	  If Items.OrderLeadTime  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.oltm  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.oltm, 0, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.tiipd001.oltm  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.oltm, Items.OrderLeadTime, Items.Exception, DefaultFound)  
	  End if  	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Planning Data (cprpd100)  
'  |   **********************************************************************************************   	   
	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	   	  ItemDefaultsPlanning.*   
	  from  	   	  ItemDefaultsPlanning  
	  where  	   	  ItemDefaultsPlanning.kitm  =  varint.itemtype And ItemDefaultsPlanning.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	  'Defaults presents but not in Item access table  	   
	  var.cprpd100.fite  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.fite, "", Items.Exception, DefaultFound)  
	  var.cprpd100.fide  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.fide, "", Items.Exception, DefaultFound)  
	  var.cprpd100.mrpu  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.mrpu, "", Items.Exception, DefaultFound)  
	  var.cprpd100.rpun  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.rpun, "", Items.Exception, DefaultFound)  
	  '  
	  var.cprpd100.audf  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.audf, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.auiv  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.auiv, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.aupr  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.aupr, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.aupu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.aupu, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.catp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.catp, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.chat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.chat, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.coat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.coat, 0, Items.Exception, DefaultFound, 2)  	   
	  var.cprpd100.cria  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.cria, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.depd  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.depd, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.deps  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.deps, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.efpg  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.efpg, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.fatp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.fatp, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.fica  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.fica, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.info  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.info, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.mult  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.mult, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.onat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.onat, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.pbpl  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.pbpl, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.prio  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.prio, 0, Items.Exception, DefaultFound, 5)  
	  var.cprpd100.uatt  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.uatt, 0, Items.Exception, DefaultFound, 5)  
	  var.cprpd100.upho  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.upho, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.utmf  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.utmf, 0, Items.Exception, DefaultFound, 1)  
	  '  
	  var.cprpd100.atho  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.atho, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.atta  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.atta, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.attm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.attm, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.fasi  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fasi, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.fltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fltm, 9999, Items.Exception, DefaultFound)  
	  var.cprpd100.hoat  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.hoat, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.inho  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.inho, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.retf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.retf, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.tfat  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tfat, 0, Items.Exception, DefaultFound)  
	  '  
	  'Defaults presents and present in Item access table  
	  var.cprpd100.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.osys,Items.MaintainMasterPlan, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.crmp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.crmp,Items.CriticalInMasterPlan, Items.Exception, DefaultFound, 2)  |   #  LN1052.n  
	  var.cprpd100.plvl  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.plvl, Items.PlanLevel, Items.Exception, DefaultFound)  
	  var.cprpd100.plid  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.plid, Items.Planner, Items.Exception, DefaultFound)  
	  If Items.ExtraLeadTime  <  "0" then  
	   	  ' Mimimum value is 0  
	   	  var.cprpd100.eltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.eltm, 0, Items.Exception, DefaultFound)  
	  Else  	   
	   	  var.cprpd100.eltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.eltm, Items.ExtraLeadTime, Items.Exception, DefaultFound)  
	  End if  
	  If Items.ForecastTimeFence  <  "0" then  
	   	  ' Mimimum value is 0  
	   	  var.cprpd100.fctf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fctf, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.cprpd100.fctf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fctf, Items.ForecastTimeFence, Items.Exception, DefaultFound)  	   
	  End if  
	  If Items.TimeFence  <  "0" then  
	   	  ' Mimimum value is 0  
	   	  var.cprpd100.tmfc  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tmfc, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.cprpd100.tmfc  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tmfc, Items.TimeFence, Items.Exception, DefaultFound)  
	  End if  
	  If Items.UnitForExtraLeadTime  =  0 Then  
	   	  'If not defined than it will be mapped with days (10)  
	   	  var.cprpd100.eltu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.eltu,10, Items.Exception, DefaultFound, 10)  
	  Else  	   
	   	  var.cprpd100.eltu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.eltu,Items.UnitForExtraLeadTime, Items.Exception, DefaultFound, 10)  
	  End if  
	  If Items.TimeFenceUnit  =  0 then  
	   	  'If not defined than it will be mapped with days (10)  
	   	  var.cprpd100.tmfu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.tmfu,10, Items.Exception, DefaultFound, 10)  
	  Else  
	   	  var.cprpd100.tmfu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.tmfu,Items.TimeFenceUnit, Items.Exception, DefaultFound, 10)  
	  End if  
	  If Items.OrderHorizon  <=  "0" then  
	   	  If Items.MaintainMasterPlan  =  2 then  
	   	   	  'If Items.OrderHorizon is not specified it will be defaulted based upon MaintainMastesPlan.  
	   	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, 180, Items.Exception, DefaultFound)  
	   	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, 180, Items.Exception, DefaultFound)  
	   	  Else  
	   	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, 360, Items.Exception, DefaultFound)  
	   	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, 180, Items.Exception, DefaultFound)  
	   	  End if  	   	   	   
	  Else  
	   	  If Items.MaintainMasterPlan  =  2 then  
	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  
	   	  Else  
	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  *  2  
	   	  End If  
	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, Items.OrderHorizon, Items.Exception, DefaultFound)  	   	   
	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, var.cprpd100.ptmf, Items.Exception, DefaultFound)  
	  End if  
	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Warehousing Data (whwmd400)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false '  
	  select  	  ItemDefaultsWarehousing.*   
	  from  	  ItemDefaultsWarehousing  
	  where  	  ItemDefaultsWarehousing.kitm  =  varint.itemtype And ItemDefaultsWarehousing.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true '  
	  endselect  
	   	   
	  'Defaults presents but not in Item access table '  
	  var.whwmd400.cfmd  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.cfmd, "", Items.Exception, DefaultFound)  
	  var.whwmd400.pkdf  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.pkdf, "", Items.Exception, DefaultFound)  	   
	  var.whwmd400.rgtm  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.rgtm, "", Items.Exception, DefaultFound)  
	  var.whwmd400.risk  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.risk, "", Items.Exception, DefaultFound)  	   
	  var.whwmd400.ffsi  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.ffsi, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.npsl  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.npsl, 0, Items.Exception, DefaultFound)  	   
	  var.whwmd400.potc  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.potc, 0, Items.Exception, DefaultFound)  	   
	  var.whwmd400.qcma  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.qcma, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.qcmi  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.qcmi, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.txta, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.ddlt  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.ddlt, 0, Items.Exception, DefaultFound) 'LN10_4.n'  
	  var.whwmd400.alle  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.alle, 0, Items.Exception, DefaultFound, 1)  
	  var.whwmd400.askp  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.askp, 0, Items.Exception, DefaultFound, 1)  	   
	  var.whwmd400.assi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.assi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ccma  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ccma, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.coas  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.coas, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.cspr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.cspr, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ctzi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ctzi, 0, Items.Exception, DefaultFound, 5)  	   
	  var.whwmd400.dmsi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmsp  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsp, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmsr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsr, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmss  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmss, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dwhs  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dwhs, 0, Items.Exception, DefaultFound, 70)  	   
	  var.whwmd400.dycd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dycd, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.excc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.excc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.hama  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.hama, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.kpsl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.kpsl, 0, Items.Exception, DefaultFound, 4)  	   
	  var.whwmd400.lveh  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lveh, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.mabc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.mabc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.niwo  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.niwo, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.owip  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owip, 0, Items.Exception, DefaultFound, 20)  	   
	  var.whwmd400.owrl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owrl, 0, Items.Exception, DefaultFound, 10)  	   
	  var.whwmd400.owrt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owrt, 0, Items.Exception, DefaultFound, 10)  	   
	  var.whwmd400.prva  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.prva, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.spri  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.spri, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.thus  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.thus, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ufpl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ufpl, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.uhnd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.uhnd, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.vers  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.vers, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.wmsc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.wmsc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.rjha  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.rjha, 0, Items.Exception, DefaultFound, 10)  	  'LN10_4.sn '  
	  var.whwmd400.tmun  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.tmun, 0, Items.Exception, DefaultFound, 10)  
	  var.whwmd400.uidt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.uidt, 0, Items.Exception, DefaultFound, 10)  	  'LN10_4.en '  
	   
	  'Defaults presents and present in Item access table'  
	  var.whwmd400.usab  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.usab, Items.ExpectedAnnualIssue, Items.Exception, DefaultFound)  
	  var.whwmd400.ivgr  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.ivgr, Items.ItemValuationGroup, Items.Exception, DefaultFound)  
	   
	  var.whwmd400.abcc  =  Ucase(Left(Items.Abcc, 1))  
	  var.whwmd400.abcc  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.abcc, var.whwmd400.abcc, Items.Exception, DefaultFound)  
	  if Items.FloorStock  =  0 Then  
	   	  'Use default value if not specified '  
	   	  var.whwmd400.pics  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.pics, 2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.whwmd400.pics  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.pics, Items.FloorStock, Items.Exception, DefaultFound, 2)  
	  end if  
	  if Items.InventoryCarryingCosts  <  "0" Then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.scst  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.scst, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.whwmd400.scst  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.scst, Items.InventoryCarryingCosts, Items.Exception, DefaultFound)  	   	   	   	   
	  End if  
	   
	  if Items.Height  <  "0" Then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.hght  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.hght, 0, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.whwmd400.hght  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.hght, Items.Height, Items.Exception, DefaultFound)  
	  end if  
	  if Items.Width  <  "0" Then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.wdth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.wdth, 0, Items.Exception, DefaultFound)  	   
	  Else  
	   	  var.whwmd400.wdth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.wdth, Items.Width, Items.Exception, DefaultFound)  
	  end if  
	  if Items.Depth  <  "0" then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.dpth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.dpth, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.whwmd400.dpth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.dpth, Items.Depth, Items.Exception, DefaultFound)  	   	   
	  end if  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case of Outbound Method  
'  |   **********************************************************************************************   
	  if Items.OutboundMethod  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.obpr  =  2 ' FIFO  
	  end if  
	   
	  If Items.ItemType  =  4 Then  
	   	  'Set default values in case of cost items  
	   	  var.whwmd400.obpr  =  3 ' By Location  
	  end if  
	  var.whwmd400.obpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.obpr, var.whwmd400.obpr, Items.Exception, DefaultFound, 3)  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case of Location Controlled  
'  |   **********************************************************************************************   	   
	  if Items.LocationControlled  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.locc  =  1 ' Yes  
	  Else  
	   	  var.whwmd400.locc  =  Items.LocationControlled  
	  End if  
	  If Items.ItemType  =  4 Then  
	   	  'Set default values in case of cost items  
	   	  var.whwmd400.locc  =  2 ' No  
	  End if  	   
	  var.whwmd400.locc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.locc, var.whwmd400.locc, Items.Exception, DefaultFound, 1)  
'  |   **********************************************************************************************   	   	   
'  |  In case of Lot Controlled  
'  |   **********************************************************************************************   	   
	  If Items.LotPrice  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.ltpr  =  2 ' No  
	  Else  
	   	  var.whwmd400.ltpr  =  Items.LotPrice  	   
	  End if  
	  if Items.LotControlled  =  1 then  
	   	  if Items.LotsInInventory  =  1 then  
	   	   	  'Lot controlled and in inventory  
	   	   	  var.whwmd400.lttr  =  1 'Yes  
	   	   	  var.whwmd400.linv  =  1 'Yes  
	   	   	  var.whwmd400.ledd  =  3 'Not applicable  
	   	   	  var.whwmd400.ledr  =  3 'Not applicable  
	   	   	  var.whwmd400.ledt  =  3 'Not applicable  
	   	   	  var.whwmd400.lisf  =  3 'Not applicable  
	   	   	  var.whwmd400.lism  =  3 'Not applicable  
	   	  else  
	   	   	  'Lot controlled not in inventory  
	   	   	  var.whwmd400.lttr  =  1 'Yes  
	   	   	  var.whwmd400.linv  =  2 'No  
	   	   	  var.whwmd400.ledd  =  1 'Yes  
	   	   	  var.whwmd400.ledr  =  2 'No  
	   	   	  var.whwmd400.ledt  =  2 'No  
	   	   	  var.whwmd400.lisf  =  2 'No  
	   	   	  var.whwmd400.lism  =  2 'No  
	   	  end if  
	   	   
	  else  
	   	  'Not lot controlled  
	   	  var.whwmd400.ltpr  =  2 'No  
	   	  var.whwmd400.lttr  =  2 'No  
	   	  var.whwmd400.linv  =  2 'No  
	   	  var.whwmd400.ledd  =  3 'Not applicable  
	   	  var.whwmd400.ledr  =  3 'Not applicable  
	   	  var.whwmd400.ledt  =  3 'Not applicable  
	   	  var.whwmd400.lisf  =  3 'Not applicable  
	   	  var.whwmd400.lism  =  3 'Not applicable  
	  end if  
	   
	  var.whwmd400.ltpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ltpr, var.whwmd400.ltpr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.lttr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lttr, var.whwmd400.lttr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.linv  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.linv, var.whwmd400.linv, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.ledd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledd, var.whwmd400.ledd, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.ledr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledr, var.whwmd400.ledr, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.ledt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledt, var.whwmd400.ledt, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.lisf  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lisf, var.whwmd400.lisf, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.lism  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lism, var.whwmd400.lism, Items.Exception, DefaultFound, 3)  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case Serialized  
'  |   **********************************************************************************************   	   
	  If Items.SerialPrice  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.srpr  =  2 ' No  
	  Else  
	   	  var.whwmd400.srpr  =  Items.SerialPrice  	   
	  End if  
	  if Items.Serialized  =  1 then  
	   	  if Items.SerialsInInventory  =  1 then  
	   	   	  'Serialized and in inventory  
	   	   	  var.whwmd400.srtr  =  1 'Yes  
	   	   	  var.whwmd400.sinv  =  1 'Yes  
	   	   	  var.whwmd400.sedd  =  3 'Not applicable  
	   	   	  var.whwmd400.sedr  =  3 'Not applicable  
	   	   	  var.whwmd400.sedt  =  3 'Not applicable  
	   	   	  var.whwmd400.sisf  =  3 'Not applicable  
	   	   	  var.whwmd400.sism  =  3 'Not applicable  
	   	  else  
	   	   	  'Serialized not in inventory  
	   	   	  var.whwmd400.srtr  =  1 'Yes  
	   	   	  var.whwmd400.sinv  =  2 'No  
	   	   	  var.whwmd400.sedd  =  1 'Yes  
	   	   	  var.whwmd400.sedr  =  2 'No  
	   	   	  var.whwmd400.sedt  =  2 'No  
	   	   	  var.whwmd400.sisf  =  2 'No  
	   	   	  var.whwmd400.sism  =  2 'No  
	   	  end if  
	  else  
	   	  ' Not serialized  
	   	  var.whwmd400.srpr  =  2 'No  
	   	  var.whwmd400.srtr  =  2 'No  
	   	  var.whwmd400.sinv  =  2 'No  
	   	  var.whwmd400.sedd  =  3 'Not applicable  
	   	  var.whwmd400.sedr  =  3 'Not applicable  
	   	  var.whwmd400.sedt  =  3 'Not applicable  
	   	  var.whwmd400.sisf  =  3 'Not applicable  
	   	  var.whwmd400.sism  =  3 'Not applicable  
	  end if  
	   
	  var.whwmd400.srpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.srpr, var.whwmd400.srpr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.srtr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.srtr, var.whwmd400.srtr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.sinv  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sinv, var.whwmd400.sinv, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.sedd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedd, var.whwmd400.sedd, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sedr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedr, var.whwmd400.sedr, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sedt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedt, var.whwmd400.sedt, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sisf  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sisf, var.whwmd400.sisf, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sism  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sism, var.whwmd400.sism, Items.Exception, DefaultFound, 3)  
	   	   	   	   	   	   	   	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item service Data (tsmdm200)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsService.*   
	  from  	  ItemDefaultsService  
	  where  	  ItemDefaultsService.kitm  =  varint.itemtype And ItemDefaultsService.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	   
	  'Defaults presents but not in Item access table  	   
	  var.tsmdm200.acos  =  ItemHandling.GetTypeEnum(ItemDefaultsService.acos, 0, Items.Exception, DefaultFound, 70)  
	  var.tsmdm200.cinc  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cinc, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tsmdm200.cmtc  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cmtc, 0, Items.Exception, DefaultFound, 20)  
	  var.tsmdm200.cmts  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cmts, 0, Items.Exception, DefaultFound, 20)  
	  var.tsmdm200.cvco  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cvco, 0, Items.Exception, DefaultFound, 15)  	   
	  var.tsmdm200.cpit  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cpit, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tsmdm200.dltp  =  ItemHandling.GetTypeEnum(ItemDefaultsService.dltp, 0, Items.Exception, DefaultFound, 4)  
	  var.tsmdm200.dtps  =  ItemHandling.GetTypeEnum(ItemDefaultsService.dtps, 0, Items.Exception, DefaultFound, 10)  
	  var.tsmdm200.owns  =  ItemHandling.GetTypeEnum(ItemDefaultsService.owns, 0, Items.Exception, DefaultFound, 10)  	  'LN10_4.n  
	  var.tsmdm200.rmcr  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rmcr, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rmsr  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rmsr, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rncw  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rncw, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rpyn  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rpyn, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rwun  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rwun, 0, Items.Exception, DefaultFound, 5)  
	  var.tsmdm200.scir  =  ItemHandling.GetTypeEnum(ItemDefaultsService.scir, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tsmdm200.sirq  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sirq, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.sswt  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sswt, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.sttp  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sttp, 0, Items.Exception, DefaultFound, 15)  	  'LN10_4.n  
	  var.tsmdm200.uval  =  ItemHandling.GetTypeEnum(ItemDefaultsService.uval, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.blag  =  ItemHandling.GetTypeString(ItemDefaultsService.blag, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ccds  =  ItemHandling.GetTypeString(ItemDefaultsService.ccds, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ccme  =  ItemHandling.GetTypeString(ItemDefaultsService.ccme, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ckgr  =  ItemHandling.GetTypeString(ItemDefaultsService.ckgr, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cmea  =  ItemHandling.GetTypeString(ItemDefaultsService.cmea, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cmpo  =  ItemHandling.GetTypeString(ItemDefaultsService.cmpo, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cogr  =  ItemHandling.GetTypeString(ItemDefaultsService.cogr, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cwte  =  ItemHandling.GetTypeString(ItemDefaultsService.cwte, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.gwte  =  ItemHandling.GetTypeString(ItemDefaultsService.gwte, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.peru  =  ItemHandling.GetTypeString(ItemDefaultsService.peru, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.prun  =  ItemHandling.GetTypeString(ItemDefaultsService.prun, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.sbct  =  ItemHandling.GetTypeString(ItemDefaultsService.sbct, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.scme  =  ItemHandling.GetTypeString(ItemDefaultsService.scme, "", Items.Exception, DefaultFound)  	   	  'LN10_4.n  
	  var.tsmdm200.smpo  =  ItemHandling.GetTypeString(ItemDefaultsService.smpo, "", Items.Exception, DefaultFound)  	   	  'LN10_4.n  
	  var.tsmdm200.swte  =  ItemHandling.GetTypeString(ItemDefaultsService.swte, "", Items.Exception, DefaultFound)  
	   
	  var.tsmdm200.mepo  =  ItemHandling.GetTypeNumber(ItemDefaultsService.mepo, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.nrpe  =  ItemHandling.GetTypeNumber(ItemDefaultsService.nrpe, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.rwdu  =  ItemHandling.GetTypeNumber(ItemDefaultsService.rwdu, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.srpd  =  ItemHandling.GetTypeNumber(ItemDefaultsService.srpd, 0, Items.Exception, DefaultFound)  
	   
	  'Defaults presents and present in Item access table  
	  var.tsmdm200.ccur  =  ItemHandling.GetTypeString(ItemDefaultsService.ccur, Items.ServiceCurrency, Items.Exception, DefaultFound)  
	  var.tsmdm200.cups  =  ItemHandling.GetTypeString(ItemDefaultsService.cups, Items.SalesUnit, Items.Exception, DefaultFound)  
	  var.tsmdm200.cuqs  =  ItemHandling.GetTypeString(ItemDefaultsService.cuqs, Items.SalesUnit, Items.Exception, DefaultFound)  
	  var.tsmdm200.cwoc  =  ItemHandling.GetTypeString(ItemDefaultsService.cwoc, Items.ServiceDepartment, Items.Exception, DefaultFound)  
	  var.tsmdm200.sigr  =  ItemHandling.GetTypeString(ItemDefaultsService.sigr, Items.SerializedItemGroup, Items.Exception, DefaultFound)  
	  var.tsmdm200.pris  =  ItemHandling.GetTypeNumber(ItemDefaultsService.pris, Items.ServicePrice, Items.Exception, DefaultFound)  
	   
'  |   **********************************************************************************************   	   	   
'  |   *  Setting variables for Item Service Data (tsmdm200)  
'  |   **********************************************************************************************   	   
	  If Items.ConfigurationControlled  <>  1 then  
	   	  var.tsmdm200.csgr  =  ItemHandling.GetTypeString(ItemDefaultsService.csgr, "", Items.Exception, DefaultFound)  
	  Else  
	   	  var.tsmdm200.csgr  =  ItemHandling.GetTypeString(ItemDefaultsService.csgr, Items.ServiceItemGroup, Items.Exception, DefaultFound)  
	  End if  
	   
	  If Items.ConfigurationControlled  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tsmdm200.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsService.seri, 0, Items.Exception, DefaultFound, 3)  	   
	  Else  
	   	  var.tsmdm200.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsService.seri, Items.ConfigurationControlled, Items.Exception, DefaultFound, 3)  	   
	  End If  
	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Project Data (tppdm005)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  select  	  ItemDefaultsProject.*   
	  from  	  ItemDefaultsProject  
	  where  	  ItemDefaultsProject.kitm  =  varint.itemtype And ItemDefaultsProject.citg  =  varstr.itemgroup  
	  selectdo  
	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	  endselect  
	   
	  'Defaults presents but not in Item access table  
	  var.tppdm005.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsProject.txta, 0, Items.Exception, DefaultFound)  
	  'Defaults presents and present in Item access table  	   
	  var.tppdm005.ccur  =  ItemHandling.GetTypeString(ItemDefaultsProject.ccur, Items.CostPriceCurrency, Items.Exception, DefaultFound)  
	   
	  If Items.ControlFunction  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.ccfu  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.ccfu, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.ccfu  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.ccfu, Items.ControlFunction, Items.Exception, DefaultFound, 1)  
	  End If  	   
	   	   
	  If Items.ProjectOrderSystem  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, 0, Items.Exception, DefaultFound, 9)  
	  Else  	   
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, Items.ProjectOrderSystem, Items.Exception, DefaultFound, 9)  
	  End If  
	   
	  If Item.PricePolicy  =  0 Then  
	   	  'Use default value if not specified  	   
	   	  var.tppdm005.cppp  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.cppp, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.cppp  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.cppp, Item.PricePolicy, Items.Exception, DefaultFound, 1)  
	  End if  	   	   
	   
	  If Items.ProjectOrderSystem  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, 0, Items.Exception, DefaultFound, 9)  
	  Else  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, Items.ProjectOrderSystem, Items.Exception, DefaultFound, 9)  
	  End if  	   
	   	   
	  If Items.RegisterProgress  =  0 Then  
	   	  'Use default value if not specified  	   
	   	  var.tppdm005.prre  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.prre, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.prre  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.prre, Items.RegisterProgress, Items.Exception, DefaultFound, 1)  	   
	  End If  
	   
	  var.tppdm005.ccit  =  get.segment.item.code(Items.CCItemProjectSegment, Items.CCItemItemSegment)  
	  var.tppdm005.ccit  =  ItemHandling.GetTypeString(ItemDefaultsProject.ccit, var.tppdm005.ccit, Items.Exception, DefaultFound)  	   
	   
	   
'  |   **********************************************************************************************   	   
'  |   *  Actual Dump Section  
'  |   **********************************************************************************************   	   
	  dump 001 '  |   *  Dump for tcibd001  
	  dump 400 '  |   *  Dump for whwmd400  
	   
	  if Items.ItemPurchaseData  <>  2 then  
	   	  dump 002 '  |   *  Dump for tdipu001  
	   	  dump 102 '  |   *  Dump for tdipu100  
	  end if  
	   
	  if Items.ItemSalesData  <>  2 then  
	   	  dump 003 '  |   *  Dump for tdisa001  
	  end if  
	   
	  if Items.ItemProductionData  <>  2 and _  
	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5) then  
	   	  dump 004 '  |   *  Dump for tiipd001  
	  end if  
	   
	  if Items.ItemType  <>  6 and Items.ItemType  <>  10 then  
	   	  dump 007 '  |   *  Dump for ticpr007  
	  end if  
	   
	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  10) then  
	   	  dump 100 '  |   *  Dump for tcibd100  
	  end if  
	   
	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5 or Items.ItemType  =  10) then  
	   	  cluster.found  =  0  
	   	  If varstr.cprj  =  "" or IsNUll(varstr.cprj) then  
	   	   	  select  	  ItemsByCluster.*   
	   	   	  from  	  ItemsByCluster  
	   	   	  where  	  (ItemsByCluster.Project  =  "" and ItemsByCluster.Item  =  varstr.item)  
	   	   	  selectdo  
	   	   	   	  cluster.found  =  1  
	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	   
	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	   
	   	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	   	  ' dump 120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
	   	   	  endselect  
	   	  Else  
	   	   	  select  	  ItemsByCluster.*   
	   	   	  from  	  ItemsByCluster  
	   	   	  where  	  (ItemsByCluster.Project  =  varstr.cprj and ItemsByCluster.Item  =  varstr.item)  
	   	   	  selectdo  
	   	   	   	  cluster.found  =  1  
	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	   
	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	   
	   	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	   	  'dump 120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
	   	   	  endselect  
	   	  End If  	   	   
	   	  if cluster.found  =  0 then  
	   	   	  varstr.clus  =  "   "  	   	   
	   	   	  var.planned.item  =  get.segment.cp.item.code(varstr.clus,varstr.cprj,varstr.item)  
	   	   	  var.cprpd100.cwar  =  Items.Warehouse  	   	   	   
	   	   	  var.cprpd100.sour  =  1  	   	   	   	   	   
	   	   	  dump 101 '  |   *  Dump for cprpd100  
	   	   	  PlanItemCode  =  PlanItemCode  +  1  
	   	   	  ' dump 120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
	   	  end if  
	   	  dump 200 '  |   *  Dump for tcibd200  
	  end if  
	   
	  if Items.ItemServiceData  <>  2 and _  
	   	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  
	   	   	  dump 201 '  |   *  Dump for tsmdm200  
	  end if  
	  if Items.ItemProjectData  <>  2 then  
	   	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  	   
	   	   	  dump 005 '  |   *  Dump for tppdm005  
	   	  end if  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:S
:QURY:START
select  	   	  Items.*
from 	   	  Items
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:X
:QURY:START
'  |   **********************************************************************************************   	   
'  |  Restructured the script for the implementation of the item defaulting.  
'  |   	   
'  |  Cleaned Source for the below solutions and marking related to previous FP version  <  9  
'  |   -  243214  
'  |   -  244255  
'  |   -  244268  
'  |   -  244355  
'  |   -  249608  
'  |   **********************************************************************************************
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:D
:QURY:START
	  dump 64 '  |  PE to tcibd001  
	  dump 65 '  |  PE to tdipu001  
	  dump 66 '  |  PE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:S
:QURY:START
select ProjectEquipments.*
from ProjectEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:D
:QURY:START
	  if ProjectSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuti  
	  end if  
	  dump 74 '  |   *  PS to tcibd001  
	  dump 75 '  |   *  PS to tdipu001  
	  dump 76 '  |   *  PS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:S
:QURY:START
select ProjectSubcontractings.*
from ProjectSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:D
:QURY:START
	  if StandardEquipments.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 61 '  |   *  SE to tcibd001  
	  dump 62 '  |   *  SE to tdipu001  
	  dump 63 '  |   *  SE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:S
:QURY:START
select StandardEquipments.*
from StandardEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:D
:QURY:START
	  if StandardSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuti  
	  end if  
	  if StandardSubcontractings.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 71 '  |   *  SS to tcibd001  
	  dump 72 '  |   *  SS to tdipu001  
	  dump 73 '  |   *  SS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:S
:QURY:START
select StandardSubcontractings.*
from StandardSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:D
:QURY:START
	  var.tdipu010.scrp  =  ItemPurchaseBP.SourcingPercentage  
	  if (var.tdipu010.scrp  =  "0") then  
	   	  var.tdipu010.scrp  =  100  
	  end if  
	   
	  var.tdipu010.efdt  =  get.utc(ItemPurchaseBP.EffectiveDate,"yes")  
	  'var.tdipu010.exdt  =  get.utc(ItemPurchaseBP.ExpDate,"yes")  
	  If ItemPurchaseBP.ExpDate  =  "" or IsNull(ItemPurchaseBP.ExpDate) then  	   
	   	  var.tdipu010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tdipu010.exdt  =  get.utc(ItemPurchaseBP.ExpDate,"yes")  
	  end if  
	  varstr.cprj  =  ItemPurchaseBP.Project  
	  varstr.item  =  ItemPurchaseBP.Item  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select  	  Items.*   
	   	  from  	   	  Items  
	   	  where  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  else  
	   	  select Items.*   
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj AND Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  end if  
	  dump 010  	  '  |   #  tdipu010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:S
:QURY:START
select ItemPurchaseBP.*
from ItemPurchaseBP
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBP
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:D
:QURY:START
	  var.tdisa010.efdt  =  get.utc(ItemSalesBP.EffectiveDate,"yes")  
	  'var.tdisa010.exdt  =  get.utc(ItemSalesBP.ExpDate,"yes")  	   
	  If ItemSalesBP.ExpDate  =  "" or IsNull(ItemSalesBP.ExpDate) then  	   
	   	  var.tdisa010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tdisa010.exdt  =  get.utc(ItemSalesBP.ExpDate,"yes")  
	  end if  
dump 010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:S
:QURY:START
select ItemSalesBP.*
from ItemSalesBP
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBP
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:D
:QURY:START
	  var.tdpcg030.efdt  =  get.utc(Matrices.EffectiveDate,"yes")  
	   
	   
	  dump 030 '  |  tdpcg030
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:S
:QURY:START
select Matrices.*
from Matrices
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:td
:TCMOD:pcg
:TFLNO:030
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Matrices
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:D
:QURY:START
	  var.tdpcg031.efdt  =  get.utc(PriceBooks.EffectiveDate,"yes")  
	  var.tdpcg031.exdt  =  get.utc(PriceBooks.ExpiryDate,"no")  	   
	  var.tdpcg031.endt  =  get.utc(PriceBooks.EntryDate,"yes")  	   
	   
	  dump 031 '  |  tdpcg031
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:S
:QURY:START
select PriceBooks.*
from PriceBooks
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:fam
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Assets
:ICOD:D
:QURY:START
	  if Assets.AssetDistrBy  =  "0" then  
	   	  var.dbfg  =  1  
	  else  
	   	  var.dbfg  =  Assets.AssetDistrBy  
	  end if  
	  if Assets.Listed  =  "0" then  
	   	  var.list  =  2  
	  else  
	   	  var.list  =  Assets.Listed  
	  end if  
	  if Assets.New  =  "0" then  
	   	  var.newu  =  1  
	  else  
	   	  var.newu  =  Assets.New  
	  end if  
	  if Assets.Owner  =  "0" then  
	   	  var.ownc  =  1  
	  else  
	   	  var.ownc  =  Assets.Owner  
	  end if  
	  if len(trim(Assets.Description))  >  0 then  
	   	  varstr.dsca  =  Assets.Description  	   	   
	  else  
	   	  varstr.dsca  =  Assets.AssetNumber  &  ", "  &  Assets.AssetExtension  
	  end if  
	   
	  var.tffam100.ratd  =  get.utc(Assets.RateDate,"yes")  
	  var.tffam100.acmd  =  get.date(Assets.LastMaintDate,"no")  
	  var.tffam100.pudt  =  get.date(Assets.PurchaseDate,"yes")  
	  var.tffam100.srvc  =  get.date(Assets.ServiceDate,"yes")  
	  dump 100 '  |  tffam100
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:fam
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Assets
:ICOD:S
:QURY:START
select Assets.*
from Assets
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:fam
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Assets
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:fam
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssetBook
:ICOD:D
:QURY:START
	  if AssetBook.DeprBelowSalvage  =  0 then  
	   	  var.bslv  =  2  
	  else  
	   	  var.bslv  =  AssetBook.DeprBelowSalvage  
	  end if  
	  if AssetBook.EconomicRecapture  =  0 then  
	   	  var.ecre  =  2  
	  else  
	   	  var.ecre  =  AssetBook.EconomicRecapture  
	  end if  
	   
	  var.tffam110.curd  =  get.date(AssetBook.RecoveryDate,"no")  
	  var.tffam110.disd  =  get.date(AssetBook.FinalDisposalDate,"no")  
	  var.tffam110.last  =  get.date(AssetBook.LastDeprDate,"no")  
	   	   
	  dump 110 '  |  tffam110
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:fam
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssetBook
:ICOD:S
:QURY:START
select AssetBook.*
from AssetBook
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:fam
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssetBook
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:D
:QURY:START
	  If Trim(varstr.SourceGLVersion)  =  "Other" then  
	  '  |  Migrate non  -  InforFMS data  
	   	  if ChartOfAccounts.Dimension1Used  =  "0" then  
	   	   	  var.dim1  =  2 '  |  Optional  
	   	  else  
	   	   	  var.dim1  =  ChartOfAccounts.Dimension1Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension2Used  =  "0" then  
	   	   	  var.dim2  =  2  
	   	  else  
	   	   	  var.dim2  =  ChartOfAccounts.Dimension2Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension3Used  =  "0" then  
	   	   	  var.dim3  =  2  
	   	  else  
	   	   	  var.dim3  =  ChartOfAccounts.Dimension3Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension4Used  =  "0" then  
	   	   	  var.dim4  =  2  
	   	  else  
	   	   	  var.dim4  =  ChartOfAccounts.Dimension4Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension5Used  =  "0" then  
	   	   	  var.dim5  =  2  
	   	  else  
	   	   	  var.dim5  =  ChartOfAccounts.Dimension5Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension6Used  =  "0" then  
	   	   	  var.dim6  =  2  
	   	  else  
	   	   	  var.dim6  =  ChartOfAccounts.Dimension6Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension7Used  =  "0" then  
	   	   	  var.dim7  =  2  
	   	  else  
	   	   	  var.dim7  =  ChartOfAccounts.Dimension7Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension8Used  =  "0" then  
	   	   	  var.dim8  =  2  
	   	  else  
	   	   	  var.dim8  =  ChartOfAccounts.Dimension8Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension9Used  =  "0" then  
	   	   	  var.dim9  =  2  
	   	  else  
	   	   	  var.dim9  =  ChartOfAccounts.Dimension9Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension10Used  =  "0" then  
	   	   	  var.dim10  =  2  
	   	  else  
	   	   	  var.dim10  =  ChartOfAccounts.Dimension10Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension11Used  =  "0" then  
	   	   	  var.dim11  =  2  
	   	  else  
	   	   	  var.dim11  =  ChartOfAccounts.Dimension11Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension12Used  =  "0" then  
	   	   	  var.dim12  =  2  
	   	  else  
	   	   	  var.dim12  =  ChartOfAccounts.Dimension12Used  
	   	  end if  
	   	  if ChartOfAccounts.DualAccountingIndicator  =  "0" then  
	   	   	  var.duac  =  1  
	   	  else  
	   	   	  var.duac  =  ChartOfAccounts.DualAccountingIndicator  
	   	  end if  
	   	  if ChartOfAccounts.FixedAssetIntegration  =  "0" then  
	   	   	  var.ifas  =  4  
	   	  else  
	   	   	  var.ifas  =  ChartOfAccounts.FixedAssetIntegration  
	   	  end if  
	   	  if ChartOfAccounts.IntegrationAccount  =  "0" then  
	   	   	  var.inta  =  2  
	   	  else  
	   	   	  var.inta  =  ChartOfAccounts.IntegrationAccount  
	   	  end if  
	   	  if ChartOfAccounts.IntegrationIndicator  =  "0" then  
	   	   	  var.iprj  =  7  
	   	  else  
	   	   	  var.iprj  =  ChartOfAccounts.IntegrationIndicator  
	   	  end if  
	   	  if ChartOfAccounts.BlockingStatus  =  "0" or Trim(ChartOfAccounts.BlockingStatus)  =  "" then  
	   	   	  var.bloc  =  1  
	   	  else  
	   	   	  var.bloc  =  ChartOfAccounts.BlockingStatus  
	   	  end if  
	   	  if var.bloc  =  1 then  
	   	   	  var.bfdt  =  get.date("","no")  
	   	   	  var.budt  =  get.date("","no")  
	   	  else  
	   	   	  var.bfdt  =  get.date(ChartOfAccounts.BlockingEffectiveFrom,"no")  
	   	   	  var.budt  =  get.date(ChartOfAccounts.BlockingEffectiveTo,"no")  
	   	  end if  
	   	  dump 008 ' | Other GL Source version  
	  else  
	  '  |  Migrate InforFMS data  
	   	  '  |  Mapping of AccountType to D  /  C Indicator  
	   	  acc.type  =  ChartOfAccounts.AccountTypeInforFMS  
	   	  if trim(acc.type)  <>  "" then  
	   	   	  varstr.OpenDate  =  ChartOfAccounts.OpenDateInforFMS  
	   	   	  varstr.ClosedDate  =  ChartOfAccounts.ClosedDateInforFMS  
	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Closed" then  
	   	   	   	  if varstr.OpenDate  =  "" then  
	   	   	   	   	  varstr.OpenDate  =  date()  
	   	   	   	  end if  
	   	   	   	  if varstr.ClosedDate  =  "" then  	   	   	   
	   	   	   	   	  varstr.ClosedDate  =  CDate("12/31/2038")  
	   	   	   	  end if  
	   	   	  end if  
	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Open" then  
	   	   	   	  varstr.OpenDate  =  ""  
	   	   	   	  varstr.ClosedDate  =  ""  
	   	   	  end if  
	   	   	  If acc.type  =  "A" or acc.type  =  "E" or acc.type  =  "V" or acc.type  =  "B" then  
	   	   	   	  varint.DebitCreditIndicator  =  1 '  |  tfgld.dbcr.debit '  |  1 '  |  Debit  
	   	   	  End If  	   
	   	   	  If acc.type  =  "L" or acc.type  =  "I" then  
	   	   	   	  varint.DebitCreditIndicator  =  2 '  |  tfgld.dbcr.credit '  |  2 '  |  Credit  	   
	   	   	  End If  	   
	   	   	  '  |  Mentioning the Account Type  
	   	   	  If acc.type  =  "A" or acc.type  =  "L" or acc.type  =  "B" then  
	   	   	   	  varint.AccountType  =  1 '  |  Balance Sheet  
	   	   	  End If  
	   	   	  if acc.type  =  "E" or acc.type  =  "V" or acc.type  =  "I" then  
	   	   	   	  varint.AccountType  =  2 '  |  Profit  &  Loss  
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GL2" then  
	   	   	   	  '  |  Determining the Status for the Blocking field  
	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free '  |  1  
	   	   	   	  '  |  Currency Analysis  
	   	   	   	  var.icur  =  1 '  |  tcicur.not.required '  |  1  
	   	   	   	  '  |  For Sublevel  
	   	   	   	  var.sublevel  =  0 '  |  ChartOfAccounts.Sublevel '  |  default()  
	   	   
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GL3" then  
	   	   	   	  '  |  Determining the Status for the Blocking field  
	   	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Open" then  
	   	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free '  |  1  
	   	   	   	  else  	   	   
	   	   	   	   	  var.status  =  3 '  |  tfgld.bloc.all.input '  |  3  
	   	   	   	  end if  
	   	   	   	  '  |  Currency Analysis  
	   	   	   	  var.icur  =  2 '  |  tcicur.required '  |  2  
	   	   	   	  '  |  For Sublevel  
	   	   	   	  var.sublevel  =  0 '  |  ChartOfAccounts.Sublevel '  |  default()  
	   
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GLE" then  
	   	   	   	  if acc.type  =  "1" or acc.type  =  "5" or acc.type  =  "6" or acc.type  =  "8" then  
	   	   	   	   	  varint.DebitCreditIndicator  =  1 '  |  tfgld.dbcr.debit  
	   	   	   	  end if  	   
	   	   	   	  if acc.type  =  "2" or acc.type  =  "3" or acc.type  =  "4" or acc.type  =  "7" then  
	   	   	   	   	  varint.DebitCreditIndicator  =  2 '  |  tfgld.dbcr.credit  
	   	   	   	  end if  	   
	   	   	   	  '  |  Mentioning the Account Type  
	   	   	   	  if acc.type  =  "1" or acc.type  =  "2" or acc.type  =  "3" then  
	   	   	   	   	  varint.AccountType  =  1 '  |  Balance Sheet  
	   	   	   	  else  
	   	   	   	   	  varint.AccountType  =  2 '  |  Profit  &  Loss  
	   	   	   	  end if  	   
	   	   	   	  '  |  Currency Analysis  	   
	   	   	   	  var.icur  =  1 '  |  tcicur.not.required  
	   	   	   	  '  |  Status of Blocking field  
	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free  
	   	   	   	  '  |  Calculating Sublevel  
	   	   	   	  var.sublevel  =  ChartOfAccounts.LedgerAccountSublevel  
	   
	   	   	  end if  
	   	   	  dump 009 '  |  Chart Of Accounts InforFMS  
	   	  end if  
	  End If
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:S
:QURY:START
select ChartOfAccounts.*
from ChartOfAccounts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:D
:QURY:START
	  dump 011
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:S
:QURY:START
select TransactionTypes.*
from TransactionTypes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:D
:QURY:START
	  If varstr.source.gl.version  =  "GL2" or varstr.source.gl.version  =  "GL3" then  
	  '  |  Migrate data for InforFMS 'M  -  Series'  
	   	  If GLTransactions.CurrencySource  =  empty then  
	   	   	  varstr.currency  =  GeneralParameters.BookingCurrency1  
	   	  Else  
	   	   	  varstr.currency  =  GLTransactions.CurrencySource  
	   	  End If  
	   	   
	   	  var.rate1  =  get.rate(GLTransactions.Rate1, var.RateFactor1)  
	   	  var.rate2  =  get.rate(GLTransactions.Rate2, var.RateFactor2)  
	   	  If GLTransactions.RateDate  =  empty then  
	   	   	  var.RateDate  =  GLTransactions.EffectiveDateInforFMS  
	   	  Else  
	   	   	  var.RateDate  =  GLTransactions.RateDate  
	   	  End If  
	   	  if trim(var.rate1)  =  "" then  	   
	   	   	  var.rate1  =  "1.000000"  
	   	  end if  
	   	  if trim(var.rate2)  =  "" then  	   
	   	   	  var.rate2  =  "0.000001"  
	   	  end if  
	   	  If GLTransactions.RateTypeSource  =  empty then  
	   	   	  varstr.RateType  =  GeneralParameters.ExchangeRateType  
	   	  Else  
	   	   	  varstr.RateType  =  GLTransactions.RateTypeSource  
	   	  End If  
	   	  If varstr.source.gl.version  =  "GL2" then  
	   	   	  var.GLTransaction.BookingAmount2  =  GLTransactions.BookingAmount2  
	   	  Else  
	   	   	  var.GLTransaction.BookingAmount2  =  0  
	   	  End If  
	   	  If GLTransactions.EffectiveDateInforFMS  <>  varstr.PrevEffectiveDate then  
	   	   	  var.tfgld106.olin  =  1  	   
	   	   	  If varstr.source.gl.version  =  "GL2" then  	   
	   	   	   	  var.DocumentID  =  var.DocumentID  +  1  
	   	   	   	  dump 018 '  |  Documents InforFMS GL2  /  GL3  
	   	   	  End If  
	   	  Else  
	   	   	  var.tfgld106.olin  =  var.tfgld106.olin  +  1  
	   	  End if  
	   	  varstr.PrevEffectiveDate  =  GLTransactions.EffectiveDateInforFMS  
	  End If  
	  varstr.dim2  =  Mid (GLTransactions.Reference1 , 22 , 1 )  
	  varstr.dim3  =  Mid (GLTransactions.Reference1 , 24 , 9 )  
	  dump 106 '  |  Finalized Transactions InforFMS GL2  /  GL3  
	  If varstr.source.gl.version  =  "GLE" then  
	  '  |  Migrate data for InforFMS 'E  -  Series'  
	   	  select  	  GLTransactions.*   
	   	  from  	  GLTransactions  
	   	  order by GLTransactions.FiscalYear, GLTransactions.Period Asc  
	   	  selectdo  
	   	   	  If GLTransactions.CurrencySource  =  empty then  
	   	   	   	  varstr.currency  =  GeneralParameters.BookingCurrency1  
	   	   	  Else  
	   	   	   	  varstr.currency  =  GLTransactions.CurrencySource  
	   	   	  End If  
	   	   	  var.rate1  =  get.rate(GLTransactions.Rate1, var.RateFactor1)  
	   	   	  var.rate2  =  get.rate(GLTransactions.Rate2, var.RateFactor2)  
	   	   	  If GLTransactions.RateDate  =  empty then  
	   	   	   	  var.RateDate  =  GLTransactions.EffectiveDate  
	   	   	  Else  
	   	   	   	  var.RateDate  =  GLTransactions.RateDate  
	   	   	  End If  
	   	   	  If GLTransactions.RateTypeSource  =  empty then  
	   	   	   	  varstr.RateType  =  GeneralParameters.ExchangeRateType  
	   	   	  Else  
	   	   	   	  varstr.RateType  =  GLTransactions.RateTypeSource  
	   	   	  End If  
	   	   	  If GLTransactions.FiscalYear  <>  varint.PrevFiscalYear Or GLTransactions.Period  <>  varint.PrevPeriod then  
	   	   	   	  var.DocumentID  =  var.DocumentID  +  1  
	   	   	   	  dump 918 '  |  Documents InforFMS GLE  
	   	  End If  
	   	  varint.PrevFiscalYear  =  GLTransactions.FiscalYear  
	   	  varint.PrevPeriod  =  GLTransactions.Period  
	   	  dump 906 '  |  Finalized Transactions InforFMS GLE  
	  endselect  
End If  
If varstr.source.gl.version  =  "Other" then  
'  |  Migrate data for other source systems  
End If
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:S
:QURY:START
select  	  GLTransactions.*
from 	  GLTransactions  
'  |  order by GLTransactions.EffectiveDateInforFMS Asc
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:D
:QURY:START
	  var.tibom010.indt  =  get.utc(BillOfMaterial.EffectiveDate,"yes")  
	  'var.tibom010.exdt  =  get.utc(BillOfMaterial.ExpiryDate,"no")  	   	   
	  If BillOfMaterial.ExpiryDate  =  "" or IsNull(BillOfMaterial.ExpiryDate) then  	   
	   	  var.tibom010.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tibom010.exdt  =  get.utc(BillOfMaterial.ExpiryDate,"no")  
	  end if  
	  dump 010 '  |  tibom010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:S
:QURY:START
select BillOfMaterial.*
from BillOfMaterial
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:bom
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BillOfMaterial
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionDepartment
:ICOD:D
:QURY:START
	  varstr.address  =  ProductionDepartment.Address  
	  select Addresses.City  
	  from Addresses  
	  where Addresses.AddressCode  =  varstr.address  
	  selectdo  
	  endselect  
	   
	  var.tcmcs065.city  =  Left(Addresses.City, 8)  
	   
	  if ProductionDepartment.EnterpriseUnit  =  "" or IsNull (ProductionDepartment.EnterpriseUnit) then  
	   	  var.EnterpriseUnit  =  GeneralParameters.DefaultEnterpriseUnit  
	  else  
	   	  var.EnterpriseUnit  =  ProductionDepartment.EnterpriseUnit  
	  end if  	   
	  dump 365 '  |  pddp tcmcs065  
	  dump 310 '  |  pddp tcemm110  
	  dump 324 '  |  pddp tcemm124
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionDepartment
:ICOD:S
:QURY:START
select ProductionDepartment.*
from ProductionDepartment
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionDepartment
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:D
:QURY:START
	  if Projects.btco  =  1 then  
	   	  var.tppdm600.cmog  =  2  
	  else  
	   	  var.tppdm600.cmog  =  3  
	  end if  
	  if Projects.intp  =  1 then  
	   	  var.tppdm600.ipin  =  2  
	  else  
	   	  var.tppdm600.ipin  =  1  
	  end if  
	  var.tppdm600.rate  =  Projects.rate  
	  if trim(var.tppdm600.rate)  =  "" or IsNull(var.tppdm600.rate) then  
	   	  var.tppdm600.rate  =  1  
	  end if  
	  var.tppdm600.guid  =  "MIG_tppdm600_"  &  Projects.cprj  	   
	  dump 600 '  |  TP to tppdm600  
	  dump 113 '  |  TP to tcemm113  
	  dump 610 '  |  TP to tcemm110
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:S
:QURY:START
select Projects.*
from Projects
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:D
:QURY:START
	  varstr.address  =  WorkCenter.Address  
	  select Addresses.City  
	  from  	  Addresses  
	  where Addresses.AddressCode  =  varstr.address  
	  selectdo  
	  endselect  
	   
	  var.tcmcs065.city  =  Left(Addresses.City, 8)  
	  dump 001 '  |  cwoc tirou001  
	  dump 065 '  |  cwoc tcmcs065  
	  dump 110 '  |  cwoc tcemm110  
	  dump 124 '  |  cwoc tcemm124  
	  dump 200 '  |  cwoc cprpd200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:S
:QURY:START
select WorkCenter.*
from WorkCenter
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:rou
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Machine
:ICOD:D
:QURY:START
dump 002
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:rou
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Machine
:ICOD:S
:QURY:START
select Machine.*
from Machine
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:ti
:TCMOD:rou
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Machine
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:D
:QURY:START
	  if CDbl(StandardEquipments.ratc)  >  0 then  
	   	  var.tppdm025.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardEquipments.rats)  >  0 then  
	   	  var.tppdm025.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrs  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardEquipments.ratp)  >  0 then  
	   	  var.tppdm025.ltrp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm025.ltrp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:S
:QURY:START
select StandardEquipments.*
from StandardEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pdm
:TFLNO:025
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:D
:QURY:START
	  if CDbl(StandardSubcontractings.pric)  >  0 then  
	   	  var.tppdm035.ltpc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltpc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSubcontractings.pris)  >  0 then  
	   	  var.tppdm035.ltps  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltps  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSubcontractings.prip)  >  0 then  
	   	  var.tppdm035.ltpp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltpp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:S
:QURY:START
select StandardSubcontractings.*
from StandardSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:D
:QURY:START
	  if CDbl(ProjectEquipments.ratc)  >  0 then  
	   	  var.tppdm625.ltrc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectEquipments.rats)  >  0 then  
	   	  var.tppdm625.ltrs  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrs  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectEquipments.ratp)  >  0 then  
	   	  var.tppdm625.ltrp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm625.ltrp  =  get.utc("","no")  
	  end if  
	  dump 01  	  '  |   *  tppdm625
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:S
:QURY:START
select ProjectEquipments.*
from ProjectEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pdm
:TFLNO:625
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:D
:QURY:START
	  if CDbl(ProjectSubcontractings.pric)  >  0 then  
	   	  var.tppdm635.ltpc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltpc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSubcontractings.pris)  >  0 then  
	   	  var.tppdm635.ltps  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltps  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSubcontractings.prip)  >  0 then  
	   	  var.tppdm635.ltpp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltpp  =  get.utc("","no")  
	  end if  
	  dump 01  	  '  |   *  tppdm635
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:S
:QURY:START
select ProjectSubcontractings.*
from ProjectSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pss
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectPlans
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pss
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectPlans
:ICOD:S
:QURY:START
select ProjectPlans.*
from ProjectPlans
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pss
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectPlans
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:D
:QURY:START
	  varstr.project  =  Activities.cprj  
	  var.btco  =  1  	   	   	   	  '  |  Default is 'Element'  
	  var.invm  =  3  	   	   	  '  |  Default is 'Installment'  
	  var.secu  =  ""  
	  var.prss  =  0.0000  
	  var.rtse.1  =  0.000000  
	  var.rtse.2  =  0.000000  
	  var.rtse.3  =  0.000000  
	  var.rfse.1  =  0  
	  var.rfse.2  =  0  
	  var.rfse.3  =  0  
	  var.prin  =  4  	   	   	   
	  var.cspt  =  3  	   	   	   
	  var.setl  =  2  
	  var.gris  =  0  
	  select Projects.invm,  
	   	  Projects.btco  
	  from  	  Projects  
	  where Projects.cprj  =  varstr.project  
	  selectdo  
	   	  var.invm  =  Projects.invm  	  '  |  Invoice Type  
	   	  var.btco  =  Projects.btco  	  '  |  Control By  
	  endselect  
	  '  |  Check if 'Invoice Type'  =  Progress Invoice and 'Control By'  =  Activity  	   
	  if var.invm  =  4 and var.btco  =  2 then  	   	   
	   	  var.secu  =  Activities.secu  
	   	  var.prss  =  Activities.prss  
	   	  var.rtse.1  =  Activities.rtse  
	   	  var.rtse.2  =  0.000001  
	   	  var.rtse.3  =  0.000001  
	   	  var.rfse.1  =  Activities.rfse  
	   	  var.rfse.2  =  1  
	   	  var.rfse.3  =  1  
	   	  var.prin  =  Activities.prin  
	   	  '  |  Determine field 'Progress for Invoice'  
	   	  if var.prin  =  3 then  
	   	   	  var.cspt  =  2 '  |  Indirect  
	   	  end if  
	   	  '  |  Determine field 'To Be Settled'  
	   	  if var.prin  =  1 and var.cspt  =  1 then  
	   	   	  var.setl  =  Activities.setl  
	   	  end if  
	   	  if var.prin  =  2 and var.cspt  =  1 then  
	   	   	  var.setl  =  Activities.setl  
	   	  end if  
	   	  '  |  Determine field 'Group Indirect Work'  
	   	  if var.prin  =  1 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	   	  if var.prin  =  2 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	   	  if var.prin  =  3 and var.cspt  =  2 then  
	   	   	  var.gris  =  Activities.gris  
	   	  end if  
	  end if  
	  '  |  In case Actual Finish Date is filled the Actual Start Date must be empty  !   
	  var.asdt  =  Activities.asdt  
	  if trim(Activities.afdt)  <>  "" then  
	   	  var.asdt  =  ""  
	  end if  
	  dump 01  	  '  |   *  tppss200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:S
:QURY:START
select Activities.*
from Activities
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pss
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Activities
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pss
:TFLNO:230
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ExternalScheduleLinks
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pss
:TFLNO:230
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ExternalScheduleLinks
:ICOD:S
:QURY:START
select ExternalScheduleLinks.*
from ExternalScheduleLinks
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:pss
:TFLNO:230
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ExternalScheduleLinks
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:S
:QURY:START
select Extensions.*
from Extensions
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:ptc
:TFLNO:050
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Extensions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:ptc
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ElementRelations
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:ptc
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ElementRelations
:ICOD:S
:QURY:START
select ElementRelations.*
from ElementRelations
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:tp
:TCMOD:ptc
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ElementRelations
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:D
:QURY:START
	  var.whltc100.ldat  =  LotsByItem.LotDate  
	  if var.whltc100.ldat  =  "" or IsNull(var.whltc100.ldat) then  
	   	  var.whltc100.ldat  =  Date()  
	  end if  
	  dump 100 '  |  Lots
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:S
:QURY:START
select  	  LotsByItem.*
from 	  LotsByItem
order by LotsByItem.Project, LotsByItem.Item, LotsByItem.Lot
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:D
:QURY:START
	  varstr.cprj  =  WarehouseItem.Project  
	  varstr.item  =  WarehouseItem.Item  
	  var.whwmd210.ialt  =  20  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select Items.LocationControlled  
	   	  from Items  
	   	  where Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  If Items.Project  =  "" or IsNull(Items.Project) then  
	   	   	   	  If Items.LocationControlled  =  1 then  
	   	   	   	   	  var.whwmd210.ialt  =  5  
	   	   	   	  else  
	   	   	   	   	  var.whwmd210.ialt  =  20  
	   	   	   	  End If  
	   	   	  End If  
	   	  endselect  
	  else  
	   	  select Items.LocationControlled  
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj  
	   	  and  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  if Items.LocationControlled  =  1 then  
	   	   	   	  var.whwmd210.ialt  =  5  
	   	   	  else  
	   	   	   	  var.whwmd210.ialt  =  20  
	   	   	  end if  
	   	  endselect  
	  end if  
	   
	  if (WarehouseItem.OrderQuantityIncrement  <=  "0") then  
	   	  var.oqmf  =  1  
	  else  
	   	  var.oqmf  =  WarehouseItem.OrderQuantityIncrement  
	  end if  
	  if (WarehouseItem.MinimumOrderQuantity  <=  "0") then  
	   	  var.mioq  =  1  
	  else  
	   	  var.mioq  =  WarehouseItem.MinimumOrderQuantity  
	  end if  
	  if (WarehouseItem.MaximumOrderQuantity  <=  "0") then  
	   	  var.maoq  =  9999999  
	  else  
	   	  var.maoq  =  WarehouseItem.MaximumOrderQuantity  
	  end if  
	  if (WarehouseItem.FixedOrderQuantity  <=  "0") then  
	   	  var.fioq  =  1  
	  else  
	   	  var.fioq  =  WarehouseItem.FixedOrderQuantity  
	  end if  
'  	  if (Warehouse_Item.EconomicOrderQuantity  <=  "0") then  	   |   #  253844.so  
'  	   	  var.ecoq  =  1  
'  	  else  
'  	   	  var.ecoq  =  Warehouse_Item.EconomicOrderQuantity  
'  	  end if  	   	   	   	   	   	   	   |   #  253844.eo  
	  if (WarehouseItem.EconomicOrderQuantity  <=  "0") then  	  '  |   #  253844.sn  
	   	  var.ecoq  =  1  
	  else  
	   	  var.ecoq  =  WarehouseItem.EconomicOrderQuantity  
	  end if  
	   	   	   	   	   	   	  '  |   #  253844.en  
	  var.whwmd210.srpr  =  2  
	  if (WarehouseItem.InventoryValuationMethod)  =  6 then  
	   	  var.whwmd210.srpr  =  1  
	  end if  
	  dump 210  	  '  |   *  whwmd210  -  Warehouse Item Data  
	  dump 215  	  '  |   *  whwmd215  -  Item Inv by Warehouse  
	  dump 216  	  '  |   *  whwmd216  -  Inv by warehouse, item , eff unit
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:S
:QURY:START
select  	  WarehouseItem.*
from 	  WarehouseItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:12
:VERS:A2LN
:RELE:10
:CUST:52CS
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:D
:QURY:START
	  var.bpmdm001.sdte  =  get.date(EmployeesPeople.FirstDateEmployment,"yes")  
	  var.bpmdm001.edte  =  get.date(EmployeesPeople.LastDateEmployment,"no")  
	  var.bpmdm001.daob  =  get.date(EmployeesPeople.DateBirth,"no")  
	  dump 001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:S
:QURY:START
select EmployeesPeople.*
from EmployeesPeople
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:bp
:TCMOD:mdm
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:EmployeesPeople
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:cp
:TCMOD:rpd
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsPlanning
:ICOD:D
:QURY:START
	  DefaultFound  =  0  	   	   	   	   	  '  |   #  Default found is false  
	  if DefaultsPlanning then  
	   	  varstr.project  =  ItemsPlanning.Project  
	   	  varstr.item  =  ItemsPlanning.Item  
	   	  varstr.cluster  =  ItemsPlanning.Cluster  
	   	  varint.itemtype  =  0  
	   	  select  	  Items.ItemType, Items.ItemGroup  
	   	  from  	  Items  
	   	  where  	  Items.Project  =  varstr.project  
	   	  and  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  varint.itemtype  =  Items.ItemType  
	   	   	  varstr.itemgroup  =  Items.ItemGroup  
	   	  endselect  
	   	   
	   	  select  	  ItemDefaultsPlanning.*   
	   	  from  	  ItemDefaultsPlanning  
	   	  where  	  ItemDefaultsPlanning.kitm  =  varint.itemtype  
	   	  and ItemDefaultsPlanning.citg  =  varstr.itemgroup  
	   	  and  	  ItemDefaultsPlanning.clus  =  varstr.cluster  
	   	  selectdo  
	   	   	  DefaultFound  =  1  	   	   	  '  |   #  Default found is true  
	   	  endselect  
	  end if  
	  'Defaults presents but not in Item access table  	   
	  var.cprpd100.fite  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.fite, "", Items.Exception, DefaultFound)  
	  var.cprpd100.fide  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.fide, "", Items.Exception, DefaultFound)  
	  var.cprpd100.mrpu  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.mrpu, "", Items.Exception, DefaultFound)  
	  var.cprpd100.rpun  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.rpun, "", Items.Exception, DefaultFound)  
	  var.cprpd100.catp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.catp, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.chat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.chat, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.coat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.coat, 0, Items.Exception, DefaultFound, 2)  	   
	  var.cprpd100.cria  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.cria, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.depd  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.depd, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.deps  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.deps, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.efpg  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.efpg, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.fatp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.fatp, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.fica  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.fica, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.info  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.info, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.mult  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.mult, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.onat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.onat, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.pbpl  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.pbpl, 0, Items.Exception, DefaultFound, 2)  
	  var.cprpd100.prio  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.prio, 0, Items.Exception, DefaultFound, 5)  
	  var.cprpd100.uatt  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.uatt, 0, Items.Exception, DefaultFound, 5)  
	  var.cprpd100.upho  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.upho, 0, Items.Exception, DefaultFound, 1)  
	  var.cprpd100.utmf  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.utmf, 0, Items.Exception, DefaultFound, 1)  
	   
	  var.cprpd100.atho  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.atho, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.atta  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.atta, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.attm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.attm, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.fasi  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fasi, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.fltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fltm, 9999, Items.Exception, DefaultFound)  
	  var.cprpd100.hoat  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.hoat, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.inho  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.inho, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.retf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.retf, 0, Items.Exception, DefaultFound)  
	  var.cprpd100.tfat  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tfat, 0, Items.Exception, DefaultFound)  
'Defaults present in LN and present in Item access table  
	  var.cprpd100.plvl  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.plvl, Items.PlanLevel, Items.Exception, DefaultFound)  
	  var.cprpd100.plid  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.plid, Items.Planner, Items.Exception, DefaultFound)  
	  var.cprpd100.eltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.eltm, Items.ExtraLeadTime, Items.Exception, DefaultFound)  
	  var.cprpd100.fctf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fctf, Items.ForecastTimeFence, Items.Exception, DefaultFound)  	   
	  var.cprpd100.tmfc  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tmfc, Items.TimeFence, Items.Exception, DefaultFound)  
	  var.cprpd100.tmfu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.tmfu,Items.TimeFenceUnit, Items.Exception, DefaultFound, 10)  
	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, Items.OrderHorizon, Items.Exception, DefaultFound)  	   	   
	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, Items.PlanningHorizon, Items.Exception, DefaultFound)  
	  If ItemsPlanning.MaintainMasterPlan  =  2 then  
	   	  var.cprpd100.audf  =  1  
	   	  var.cprpd100.auiv  =  1  
	   	  var.cprpd100.aupr  =  1  
	   	  var.cprpd100.aupu  =  1  
	  else  
	   	  var.cprpd100.audf  =  4  
	   	  var.cprpd100.auiv  =  4  
	   	  var.cprpd100.aupr  =  4  
	   	  var.cprpd100.aupu  =  4  
	  end if  
	  if ItemsPlanning.Project  =  "PROJEMPTY" then  
	   	  var.cprpd100.cprj  =  ""  
	  else  
	   	  var.cprpd100.cprj  =  ItemsPlanning.Project  
	  end if  
	  if ItemsBySite.SupplySource  =  20 then '  |   *  JOBSHOP  
	   	  var.cprpd100.sour  =  target(cprpd.sour.manpur)  
	  else  
	   	  var.cprpd100.sour  =  target(cprpd.sour.distribution)  
	  end if  
	  dump 001 '  |   *  Items Planning
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:cp
:TCMOD:rpd
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsPlanning
:ICOD:S
:QURY:START
select  	  ItemsPlanning.*  , ItemsBySite.SupplySource
from 	  ItemsPlanning, ItemsBySite
where 	  ItemsPlanning.Project  =  ItemsBySite.Project  
and  	  ItemsPlanning.Item  =  ItemsBySite.Item  
and  	  ItemsPlanning.OrderingSite  =  ItemsBySite.Site
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:cp
:TCMOD:rpd
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsPlanning
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:D
:QURY:START
	  '  |  IVG111  
	  var.cprpd710.effd  =  get.utc(SourcingStrategies.EffectivityDate, "yes")  
	  var.cprpd710.expd  =  get.utc(SourcingStrategies.ExpiryDate, "no")  	   
dump 710
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:S
:QURY:START
select SourcingStrategies.*
from SourcingStrategies
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:cp
:TCMOD:rpd
:TFLNO:710
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SourcingStrategies
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:com
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Employees
:ICOD:D
:QURY:START
dump 001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:com
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Employees
:ICOD:S
:QURY:START
select Employees.*
from Employees
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:com
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Employees
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:D
:QURY:START
	  varstr.bp  =  BusinessPartner.BusinessPartner  
	  CustomerRoles  =  0  
	  SupplierRoles  =  0  
	  if BusinessPartner.SearchKey  <>  "" then  
	   	  var.tccom100.seak  =  UCase(Left(BusinessPartner.SearchKey,16))  
	  else  
	   	  var.tccom100.seak  =  UCase(Left(BusinessPartner.Name,16))  
	  end if  
	  var.tccom100.stdt  =  get.utc(BusinessPartner.StartDate, "no")  
	  if BusinessPartner.SoldTo  =  1 then  
	   	  CustomerRoles  =  1  
	   	  dump 110 '  |   #  tccom110  
	  end if  
	  if BusinessPartner.ShipTo  =  1 then  
	   	  if Trim(BusinessPartner.ShipToAddress)  <>  "" then  
	   	   	  varstr.address  =  BusinessPartner.ShipToAddress  
	   	  else  
	   	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  end if  
	   	  CustomerRoles  =  1  
	   	  dump 111 '  |   #  tccom111  
	  end if  
	  if BusinessPartner.InvoiceTo  =  1 then  
	   	  if Trim(BusinessPartner.InvoiceToAddress)  <>  "" then  
	   	   	  varstr.address  =  BusinessPartner.InvoiceToAddress  
	   	  else  
	   	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  end if  
	   	  CustomerRoles  =  1  
	   	  var.tccom112.edci  =  get.utc(BusinessPartner.ExpiryDateInsuredCredit,"no")  
	   	  dump 112 '  |   #  tccom112  
	  end if  
	  if BusinessPartner.PayBy  =  1 then  
	   	  CustomerRoles  =  1  
'  |  243210.sn  
	   	  var.tccom114.cban  =  ""  
	   	  select BankAccountsByPayByBP.*   
	   	  from BankAccountsByPayByBP  
	   	  where BankAccountsByPayByBP.PayByBusinessPartner  =  varstr.bp  
	   	  order by BankAccountsByPayByBP.BankAccountCode desc  
	   	  selectdo  
	   	   	  var.tccom114.cban  =  BankAccountsByPayByBP.BankAccountCode  
	   	  endselect  
'  |  243210.en  
	   	  dump 114 '  |   #  tccom114  
	  end if  
	  if BusinessPartner.BuyFrom  =  1 then  
	   	  SupplierRoles  =  1  
	   	  dump 120 '  |   #  tccom120  
	  end if  
	  if BusinessPartner.ShipFrom  =  1 then  
	   	  SupplierRoles  =  1  
	   	  dump 121 '  |   #  tccom121  
	  end if  
	  if BusinessPartner.InvoiceFrom  =  1 then  
	   	  SupplierRoles  =  1  
'  |  FP7.sn  	   	   
	   	  var.tccom122.cadr  =  BusinessPartner.AddressCode  
	   	  var.tccom122.rtyp  =  BusinessPartner.ExchangeRateType  
	   	  var.tccom122.crlr  =  BusinessPartner.CreditLimit  
	   	  if Not IsNull(BusinessPartner.CreditLimit) then  
	   	   	  var.tccom122.crlr  =  BusinessPartner.CreditLimit  
	   	  else  
	   	   	  var.tccom122.crlr  =  0.0  
	   	  end if  	   	   	   
	   	  var.tccom122.cpay  =  BusinessPartner.TermsPayment  
	   	  var.tccom122.ccrs  =  BusinessPartner.LatePaymentSurcharge  
	   	  var.tccom122.paym  =  BusinessPartner.PaymentMethod  
	   	  varstr.businesspartner  =  BusinessPartner.BusinessPartner  
	   	  select BusinessPartnerExtension.*   
	   	  from BusinessPartnerExtension  
	   	  where BusinessPartnerExtension.BusinessPartner  =  varstr.businesspartner  
	   	  selectdo  
	   	   	  if BusinessPartnerExtension.AddressCodeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.cadr  =  BusinessPartnerExtension.AddressCodeInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.ExchangeRateTypeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.rtyp  =  BusinessPartnerExtension.ExchangeRateTypeInvFrom  
	   	   	  end if  	   	   
	   	   	  if Not IsNull(BusinessPartnerExtension.CreditLimitInvFrom) then  
	   	   	   	  var.tccom122.crlr  =  BusinessPartnerExtension.CreditLimitInvFrom  
	   	   	  end if  	   	   
	   	   	  if BusinessPartnerExtension.TermsPaymentInvFrom  <>  "" then  
	   	   	   	  var.tccom122.cpay  =  BusinessPartnerExtension.TermsPaymentInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.LatePaymentSurchargeInvFrom  <>  "" then  
	   	   	   	  var.tccom122.ccrs  =  BusinessPartnerExtension.LatePaymentSurchargeInvFrom  
	   	   	  end if  
	   	   	  if BusinessPartnerExtension.PaymentMethodInvFrom  <>  "" then  
	   	   	   	  var.tccom122.paym  =  BusinessPartnerExtension.PaymentMethodInvFrom  
	   	   	  end if  
	   	  endselect  
|  FP7.en  
	   	  dump 122 '  |   #  tccom122  
	  end if  
	  if BusinessPartner.PayTo  =  1 then  
	   	  SupplierRoles  =  1  
'  |   *  Determine Bank Code  
'  |   *   #  42.sn  
	   	  var.tccom124.cban  =  ""  
	   	  select BankAccountsByPayToBP.*   
	   	  from  	  BankAccountsByPayToBP  
	   	  where BankAccountsByPayToBP.PayToBusinessPartner  =  varstr.bp  
	   	  order by BankAccountsByPayToBP.BankAccountCode desc  
	   	  selectdo  
	   	   	  var.tccom124.cban  =  BankAccountsByPayToBP.BankAccountCode  
	   	  endselect  
'  |   *   #  42.en  
	   	  dump 124 '  |   #  tccom124  
	  end if  
	  if CustomerRoles  =  0 then  
	   	  if SupplierRoles  =  0 then  
	   	   	  var.tccom100.bprl  =  1  
	   	  else  
	   	   	  var.tccom100.bprl  =  3  
	   	  end if  
	  else  
	   	  if SupplierRoles  =  0 then  
	   	   	  var.tccom100.bprl  =  2  
	   	  else  
	   	   	  var.tccom100.bprl  =  4  
	   	  end if  
	  end if  
	  dump 100 '  |   #  tccom100  
	  If trim(BusinessPartner.TaxNumber)  <>  "" then  
	   	  varstr.address  =  BusinessPartner.AddressCode  
	   	  var.tctax400.ccty  =  ""  
	   	  select  	  Addresses.*   
	   	  from  	  Addresses  
	   	  where  	  Addresses.AddressCode  =  varstr.address  
	   	  selectdo  
	   	   	  var.tctax400.ccty  =  Addresses.Country  
	   	  endselect  
	   	  dump 400 '  |   #  tctax400  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:S
:QURY:START
select  	  BusinessPartner.*
from 	  BusinessPartner
order by BusinessPartner.ParentBusinessPartner, BusinessPartner.BusinessPartner
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:com
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BusinessPartner
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:D
:QURY:START
	  if Addresses.SearchKey  <>  "" then  
	   	  var.tccom130.seak  =  Ucase(Left(Addresses.SearchKey,16))  
	  else  
	   	  var.tccom130.seak  =  Ucase(Left(Addresses.Name,16))  
	  end if  
'  |  Determine default messaging method  
'  |  SITA not used  
	  var.tccom130.defa  =  10  
'target(tccom.defa.not.applicable)  
	  if Addresses.SMSNumber  <>  "" then  
	   	  var.tccom130.defa  =  5 'to.target(tccom.defa.sms)  
	  end if  
	  if Addresses.Telex  <>  "" then  
	   	  var.tccom130.defa  =  3 ' to.target(tccom.defa.telex)  
	  end if  
	  if Addresses.Fax  <>  "" then  
	   	  var.tccom130.defa  =  2' to.target(tccom.defa.fax)  
	  end if  
	  if Addresses.Email  <>  "" then  
	   	  var.tccom130.defa  =  1 ' to.target(tccom.defa.email)  
	  end if  
	  if len(trim(Addresses.Telephone))  >  0 then  
	   	  var.tccom130.defa  =  6 ' to.target(tccom.defa.phone)  
	  end if  
'  |  end determine defa  
	  If Addresses.GPSLatitude  <>  "" then  	   	   	   	   	   	  'LN1052.sn  
	   	  var.tccom130.glat  =  Addresses.GPSLatitude  
	  else  
	   	  var.tccom130.glat  =  0  
	  end if  	   	   	   	   	   	   	   	   	   	   
	  If Addresses.GPSLongitude  <>  "" then  	   	   	   	   	   
	   	  var.tccom130.glon  =  Addresses.GPSLongitude  
	  else  
	   	  var.tccom130.glon  =  0  
	  end if  	   	   	   	   	   	   	   	   	   	  'LN1052.en  
	  dump 130 '  |   #  tccom130  
'  
	  if len(trim(Addresses.ZipPostalCode))  >  0 then  
	   	  if var.country  <>  trim(Addresses.Country) or _  
	   	  var.zipcode  <>  trim(Addresses.ZipPostalCode) then  
	   	   	  var.country  =  trim(Addresses.Country)  
	   	   	  var.zipcode  =  trim(Addresses.ZipPostalCode)  
	   	   	  dump 136 '  |   #  tccom136  
	   	  end if  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:S
:QURY:START
select Addresses.*
from Addresses
order by Addresses.Country, Addresses.ZipPostalCode
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:com
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:D
:QURY:START
	  if trim(Contacts.SearchKey)  <>  "" then  
'  |   	   	  var.tccom140.seak  =  Ucase(Left(Contact.SearchKey,16)) '  |   *  249609.o  
	   	  var.tccom140.seak  =  Ucase(Left(Contacts.SearchKey,16)) '  |   *  249609.n  
	  else  
	   	  var.tccom140.seak  =  Ucase(Left(Contacts.FamilyName, 16))  
	  end if  
	   
	  var.tccom140.fuln  =  trim (Contacts.GivenName)  &  " "  &  trim(Contacts.MiddleName)  &  " "  &  trim(Contacts.FamilyName)  
	   
	  var.tccom140.bthd  =  get.date(Contacts.BirthDay,"no")  
	  var.tccom140.pelp  =  2  
	  var.tccom140.peld  =  2  
	  var.tccom140.pehm  =  2  
	  var.tccom140.pelm  =  2  
	  if trim (Contacts.Telephone)  <>  "" then  
	   	  var.tccom140.pelp  =  1 '  |  yes if Office phone filled  
	  else  
	   	  if trim (Contacts.Cellphone)  <>  "" then  
	   	   	  var.tccom140.pelm  =  1 '  |  yes If Mobile phone is filled  
	   	  else  
	   	   	  if trim (Contacts.PhonePrivate)  <>  "" then  
	   	   	   	  var.tccom140.pehm  =  1 '  |  yes If private phone is filled  
	   	   	  else  
	   	   	   	  if trim (Contacts.DirectDial)  <>  "" then  
	   	   	   	   	  var.tccom140.peld  =  1 '  |  yes If Direct Dial is filled  
	   	   	   	  end if  
	   	   	  end if  
	   	  end if  	   
	  end if  	   
	  dump 140  	  '  |   #  tccom140
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:S
:QURY:START
select Contacts.*
from Contacts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:com
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Contacts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:emm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionDepartment
:ICOD:D
:QURY:START
	  if ProductionDepartment.EnterpriseUnit  =  "" or IsNull (ProductionDepartment.EnterpriseUnit) then  
	   	  var.EnterpriseUnit  =  GeneralParameters.DefaultEnterpriseUnit  
	  else  
	   	  var.EnterpriseUnit  =  ProductionDepartment.EnterpriseUnit  
	  end if  	   
	  var.tcemm110.enty  =  12  
	  var.tcemm110.loco  =  GeneralParameters.TargetCompanyNumber  
	  var.tcemm110.enid  =  ProductionDepartment.Code  
	  var.tcemm110.grid  =  var.EnterpriseUnit  
	  dump 110 '  |  tcemm110  	   
	   
	  var.tcemm124.dtyp  =  5  
	  var.tcemm124.cwoc  =  ProductionDepartment.Code  
	  var.tcemm124.enid  =  ProductionDepartment.Code  
	  var.tcemm124.grid  =  var.EnterpriseUnit  
	  var.tcemm124.site  =  ProductionDepartment.Site  
	  dump 124 '  |  tcemm124
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:emm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionDepartment
:ICOD:S
:QURY:START
select ProductionDepartment.*
from ProductionDepartment
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:emm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionDepartment
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:emm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:D
:QURY:START
	  var.tcemm110.enty  =  7  
	  var.tcemm110.loco  =  Projects.ncmp  
	  var.tcemm110.enid  =  Projects.cprj  
	  var.tcemm110.grid  =  Projects.grid  
	  dump 110 '  |  tcemm110  	   
	   
	  var.tcemm113.loco  =  Projects.ncmp  
	  var.tcemm113.proj  =  Projects.cprj  
	  var.tcemm113.enid  =  Projects.cprj  
	  var.tcemm113.grid  =  Projects.grid  
	  dump 113 '  |  tcemm113  
	
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:emm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:S
:QURY:START
select Projects.*
from Projects
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:emm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:emm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Stations
:ICOD:D
:QURY:START
	  if Stations.EnterpriseUnit  =  "" or IsNull (Stations.EnterpriseUnit) then  
	   	  var.EnterpriseUnit  =  GeneralParameters.DefaultEnterpriseUnit  
	  else  
	   	  var.EnterpriseUnit  =  Stations.EnterpriseUnit  
	  end if  	   
	  if Stations.LogisticCompany  =  0 then  
	   	  var.LogisticCompany  =  GeneralParameters.TargetCompanyNumber  
	  else  
	   	  var.LogisticCompany  =  Stations.LogisticCompany  
	  end if  
	  '  |  Variables for tcemm110  
	  var.tcemm110.enty  =  4  
	  var.tcemm110.loco  =  var.LogisticCompany  
	  var.tcemm110.enid  =  Stations.Station  
	  var.tcemm110.grid  =  var.EnterpriseUnit  
	  dump 110 '  |  tcemm110  	   
	  '  |  Variables for tcemm124  	   
	  var.tcemm124.dtyp  =  4  
	  var.tcemm124.cwoc  =  Stations.Station  
	  var.tcemm124.enid  =  Stations.Station  
	  var.tcemm124.grid  =  var.EnterpriseUnit  
	  var.tcemm124.site  =  ""  	   	   	  ' | No site for Stations.  
	  dump 124 '  |  tcemm124
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:emm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Stations
:ICOD:S
:QURY:START
select Stations.*
from 	  Stations
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:emm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Stations
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:emm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:D
:QURY:START
	  var.tcemm110.enty  =  4  
	  var.tcemm110.loco  =  GeneralParameters.TargetCompanyNumber  
	  var.tcemm110.enid  =  WorkCenter.WorkCenter  
	  var.tcemm110.grid  =  WorkCenter.EnterpriseUnit  
	  dump 110 '  |  tcemm110  	   
	   
	  var.tcemm124.dtyp  =  4  
	  var.tcemm124.cwoc  =  WorkCenter.WorkCenter  
	  var.tcemm124.enid  =  WorkCenter.WorkCenter  
	  var.tcemm124.grid  =  WorkCenter.EnterpriseUnit  
	  var.tcemm124.site  =  WorkCenter.Site  
	  dump 124 '  |  tcemm124
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:emm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:S
:QURY:START
select WorkCenter.*
from WorkCenter
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:emm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:D
:QURY:START
'  |   **********************************************************************************************   
'  |  Function Flow  
'  |  1  -  Setting of some global variables.  
'  |  2  -  For each dump table  
'  |   	   	  a  -  Handle defaulting fields not in the item access table  
'  |   	   	  b  -  Handle defaulting fields als in item access table  
'  |   	   	  c  -  All other variables for the dump table are set.  
'  |   	   	  Based upon specific values in the Item Access table a variable is set which is  
'  |   	   	  used in the dumps.  
'  |  3  -  Dump section for all tables.  
'  |   	   
'  |   **********************************************************************************************   
	  varstr.cprj  	   	   =  Items.Project  
	  varstr.item  	   	   =  Items.Item  
	  varstr.itemgroup  	   =  Items.ItemGroup  	   	   	   	   
	  varint.itemtype  	   =  Items.ItemType  
	  if Items.Exception  =  0 then  
	   	  Items.Exception  =  1  
	  end if  	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for General Data (tcibd001)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  if DefaultsGeneral then  	   	   	   	   	   	  '  |  LN10605.n  
	   	  select  	  ItemDefaultsGeneral.*   
	   	  from  	   	  ItemDefaultsGeneral  
	   	  where  	   	  ItemDefaultsGeneral.kitm  =  varint.itemtype And ItemDefaultsGeneral.citg  =  varstr.itemgroup  
	   	  selectdo  
	   	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	   	  endselect  
	  end if  	   	   	   	   	   	   	  '  |  LN10605.n  	   
	  'Defaults presents but not in Item access table  	   
	  var.tcibd001.ccfg  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ccfg, "", Items.Exception, DefaultFound)  	  'LN10_4.n  
	  var.tcibd001.exin  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.exin, "", Items.Exception, DefaultFound)  
	   
	  var.tcibd001.chma  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.chma, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.cnfg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.cnfg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.dpcr  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpcr, 0, Items.Exception, DefaultFound, 100)  
	  var.tcibd001.dpeg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpeg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.dptp  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dptp, 0, Items.Exception, DefaultFound, 90)  
	  var.tcibd001.dpuu  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.dpuu, 0, Items.Exception, DefaultFound, 2)  	   	   
	  var.tcibd001.edco  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.edco, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.eitm  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.eitm, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.icsi  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.icsi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tcibd001.itmt  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.itmt, 0, Items.Exception, DefaultFound, 10)  
	  var.tcibd001.ippg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ippg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.mcoa  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.mcoa, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.opol  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.opol, 0, Items.Exception, DefaultFound, 2)  	  'LN1052.n  
	  var.tcibd001.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.osys, 0, Items.Exception, DefaultFound, 2)  	  'LN1052.n  
	  var.tcibd001.ppeg  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ppeg, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.psiu  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.psiu, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.sayn  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.sayn, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.styp  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.styp, 0, Items.Exception, DefaultFound, 1)  
	  var.tcibd001.subc  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.subc, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd001.wpcs  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.wpcs, 0, Items.Exception, DefaultFound, 2)  	  'LN1052.n  
	   
	  'Defaults presents and present in Item access table  
	  var.tcibd001.ccde  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ccde, Items.CommodityCode, Items.Exception, DefaultFound)  
	  var.tcibd001.cean  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cean, Items.EANCode, Items.Exception, DefaultFound)  
	  var.tcibd001.cmnf  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cmnf, Items.Manufacturer, Items.Exception, DefaultFound)  
	  var.tcibd001.cood  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cood, Items.TechnicalCoordinator, Items.Exception, DefaultFound)  
	  var.tcibd001.cpcl  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpcl, Items.ProductClass, Items.Exception, DefaultFound)  
	  var.tcibd001.cpcp  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpcp, Items.CostComponent, Items.Exception, DefaultFound)  
	  var.tcibd001.cpln  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cpln, Items.ProductLine, Items.Exception, DefaultFound)  
	  var.tcibd001.csel  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.csel, Items.SelectionCode, Items.Exception, DefaultFound)  
	  var.tcibd001.csig  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.csig, Items.ItemSignal, Items.Exception, DefaultFound)  
	  var.tcibd001.ctyo  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ctyo, Items.CountryOrigin, Items.Exception, DefaultFound)  
	  var.tcibd001.ctyp  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.ctyp, Items.ProductType, Items.Exception, DefaultFound)  
	  var.tcibd001.cuni  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cuni, Items.InventoryUnit, Items.Exception, DefaultFound)  
	  var.tcibd001.dscb  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscb, Items.Material, Items.Exception, DefaultFound)  
	  var.tcibd001.dscc  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscc, Items.Size, Items.Exception, DefaultFound)  
	  var.tcibd001.dscd  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.dscd, Items.Standard, Items.Exception, DefaultFound)  
	  var.tcibd001.uset  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.uset, Items.UnitSet, Items.Exception, DefaultFound)  
	  var.tcibd001.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.txta, Items.TextIDGeneral, Items.Exception, DefaultFound)  
	  var.tcibd001.coeu  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.coeu, Item.StandardCostsAtLevel, Items.Exception, DefaultFound, 2)  	  'LN10605.n  
	  if Items.WeightUnit  =  "" then  
	   	  var.tcibd001.cwun  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cwun, var.weight.unit, Items.Exception, DefaultFound)  
	   	  var.tcibd001.wght  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.wght, 0, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd001.cwun  =  ItemHandling.GetTypeString(ItemDefaultsGeneral.cwun, Items.WeightUnit, Items.Exception, DefaultFound)  
	   	  var.tcibd001.wght  =  ItemHandling.GetTypeNumber(ItemDefaultsGeneral.wght, Items.Weight, Items.Exception, DefaultFound)  
	  end if  
'LN10605.sc  	   
'  	  var.tcibd001.srce  =  DetermineSrce(Items.ItemType)  
'  	  var.tcibd001.srce  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.srce, var.tcibd001.srce, Items.Exception,DefaultFound, 10)  
	   	  var.tcibd001.srce  =  target(tcsrce.not.appl)  
'LN10605.ec  	   
'  |   **********************************************************************************************   
'  |  In case of Lot Controlled and Serialized Items(tcibd001)  	   	   
'  |   **********************************************************************************************   
'LN10605.sc  
'Item Type Product or Generic  
'  	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	  if Items.ItemType  =  30 or Items.ItemType  =  90 then  
'LN10605.ec  
	   	  var.tcibd001.ltct  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ltct, Items.LotControlled, Items.Exception, DefaultFound, 2)  
	   	  var.tcibd001.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.seri, Items.Serialized, Items.Exception, DefaultFound, 2)  
	  else  
	   	  var.tcibd001.ltct  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.ltct, 2, Items.Exception, DefaultFound, 2)  
	   	  var.tcibd001.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsGeneral.seri, 2, Items.Exception, DefaultFound, 2)  
	  end if  
	   	   	   
'  |   **********************************************************************************************   
'  |  Settings for General Item data (tcibd001)  
'  |   **********************************************************************************************   
	  if Items.SearchKeyI  <>  "" then  
	   	  var.tcibd001.seak  =  UCase(Left(Items.SearchKeyI, 16))  
	  else  
	   	  var.tcibd001.seak  =  UCase(Left(Items.ItemDescription, 16))  
	  end if  
	   
	  if Items.SearchKeyII  <>  "" then  
	   	  var.tcibd001.seab  =  UCase(Left(Items.SearchKeyII, 16))  
	  else  
	   	  var.tcibd001.seab  =  UCase(Left(Items.Item, 16))  
	  end if  
	   
'  |   **********************************************************************************************   
'  |  Settings for Alternative Items (tcibd001)  
'  |   **********************************************************************************************   
	  var.tcibd001.repl  =  5  	   	   	   	   	   	  '  |  Not Applicable  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where ( AlternativeItems.Project  =  "" and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  10  	   	   	   	  '  |  Replaced  
	   	  endselect  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  "" and AlternativeItems.AlternativeItem  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  15  	   	   	   	  '  |  Substitute  
	   	  endselect  
	  else  
	   	  select AlternativeItems.*   
	   	  from AlternativeItems  
	   	  where (AlternativeItems.Project  =  varstr.cprj and AlternativeItems.Item  =  varstr.item)  
	   	  and AlternativeItems.Replacement  =  1  
	   	  selectdo  
	   	   	  var.tcibd001.repl  =  10  	   	   	   	  '  |  Replaced  
	   	  endselect  
	  end if  
	   
	   
'  |   *  LN10605.so  
'  |   ***  Items Costing will be moved to a new object. Enterprise unit is now mandatory and a new  
'  |   ***  access database table is now avaialable for Items Costing data.  	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Costing Data (ticpr007)  
'  |   **********************************************************************************************   	   
'  	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
'  	  if DefaultsCosting then  	   	   	   	   	   	  '  |  LN10605.n  	   
'  	   	  select  	  ItemDefaultsCosting.*   
'  	   	  from  	  ItemDefaultsCosting  
'  	   	  where  	  ItemDefaultsCosting.kitm  =  varint.itemtype And ItemDefaultsCosting.citg  =  varstr.itemgroup  
'  	   	  selectdo  
'  	   	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
'  	   	  endselect  
'  	  end if  	   	   	   	   	   	   	  '  |  LN10605.n  
'  	  'Defaults presents but not in Item access table  	   
'  	  var.ticpr007.chrt  =  ItemHandling.GetTypeString(ItemDefaultsCosting.chrt, "", Items.Exception, DefaultFound)  	   
'  	  var.ticpr007.lcst  =  ItemHandling.GetTypeString(ItemDefaultsCosting.lcst, "", Items.Exception, DefaultFound)  
'  	  var.tcibd007.inlc  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.inlc, 0, Items.Exception, DefaultFound, 2)  
'  	   
'  	  'Defaults presents and present in Item access table  
''  	  var.tcibd007.acpm  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpm, Items.AggregatedMaterialCostCompo, Items.Exception, DefaultFound)  	   	   |   #  LN1060.o  
'  	  var.tcibd007.ccur  =  ItemHandling.GetTypeString(ItemDefaultsCosting.ccur, Items.CostingCurrency, Items.Exception, DefaultFound)  
'  	  var.tcibd007.spit  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.spit, Items.SurchargesbyItem, Items.Exception, DefaultFound, 2)  
'  	  var.tcibd007.vpwh  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.vpwh, Items.SurchargesbyWarehouse, Items.Exception, DefaultFound, 2)  
'  	   
''  	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  	   	   	   	   	   	   	   	   |   #  LN1060.so  
''  	   	  var.tcibd007.acpo  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpo, Items.AggregatedOperationCostComp, Items.Exception, DefaultFound)  
''  	   	  var.tcibd007.acps  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acps, Items.AggregatedSurchargeCostComp, Items.Exception, DefaultFound)  
''  	  else  
''  	   	  var.tcibd007.acpo  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acpo, "", Items.Exception, DefaultFound)  
''  	   	  var.tcibd007.acps  =  ItemHandling.GetTypeString(ItemDefaultsCosting.acps, "", Items.Exception, DefaultFound)  
''  	  end if  	   	   	   	   	   	   	   	   	   	   	   	   	   	   	   |   #  LN1060.eo  
'  |   *  LN10605.eo  
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Purchase Data (tdipu001)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  if DefaultsPurchase then  	   	   	   	   	   	  '  |  LN10605.n  
	   	  select  	  ItemDefaultsPurchase.*   
	   	  from  	  ItemDefaultsPurchase  
	   	  where  	  ItemDefaultsPurchase.kitm  =  varint.itemtype And ItemDefaultsPurchase.citg  =  varstr.itemgroup  
	   	  selectdo  
	   	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	   	  endselect  	   
	  end if  	   	   	   	   	   	   	  '  |  LN10605.n  
	   	   
	  'Defaults presents but not in Item access table  	   
	  var.tdipu001.cncd  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cncd, "", Items.Exception, DefaultFound)  	  'LN10_4.n  
	   
	  var.tdipu001.lcmp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.lcmp, GeneralParameters.TargetCompanyNumber, Items.Exception, DefaultFound)  	  'LN1052.n  
	  var.tdipu001.rtdm  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtdm, 0, Items.Exception, DefaultFound)  
	  var.tdipu001.rtdp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtdp, 0, Items.Exception, DefaultFound)  	   
	  var.tdipu001.rtqm  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtqm, 0, Items.Exception, DefaultFound)  
	  var.tdipu001.rtqp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.rtqp, 0, Items.Exception, DefaultFound)  
	   
	  var.tdipu001.acci  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.acci, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.casl  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.casl, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.cims  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.cims, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.hstq  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.hstq, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.hstd  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.hstd, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.issp  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.issp, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.mmnf  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.mmnf, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.mpyn  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.mpyn, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tdipu001.rqms  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.rqms, 0, Items.Exception, DefaultFound, 2)  
	  var.tdipu001.rmss  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.rmss, 0, Items.Exception, DefaultFound, 2)  	   	   	   	  'LN10_4.n  
	  'var.tdipu001.qual  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.qual, 0, Items.Exception, DefaultFound, 2)  	   	   	   	  'LN10605.o  
	  var.tdipu001.scus  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.scus, 0, Items.Exception, DefaultFound, 2)  	   	   	   	  'LN1052.n  
	  var.tdipu001.spco  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.spco, 0, Items.Exception, DefaultFound, 2)  	   	   	   	  'LN10605.n  
	  var.tdipu001.styp  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.styp, 0, Items.Exception, DefaultFound, 2)  	   	   	   	  'LN1052.n  
	  var.tdipu001.vryn  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.vryn, 0, Items.Exception, DefaultFound, 1)  
	   
	  'Defaults presents and present in Item access table  
	  var.tdipu001.buyr  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.buyr, Items.Buyer, Items.Exception, DefaultFound)  
	  var.tdipu001.ccur  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.ccur, Items.PurchaseCurrency, Items.Exception, DefaultFound)  
	  var.tdipu001.cofc  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cofc, Items.PurchaseOffice, Items.Exception, DefaultFound)  
	  var.tdipu001.cpgp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cpgp, Items.PurchasePriceGroup, Items.Exception, DefaultFound)  
	  var.tdipu001.csgp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.csgp, Items.PurchaseStatisticsGroup, Items.Exception, DefaultFound)  
	  var.tdipu001.cupp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cupp, Items.PurchasePriceUnit, Items.Exception, DefaultFound)  
	  var.tdipu001.cuqp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cuqp, Items.PurchaseUnit, Items.Exception, DefaultFound)  
	  var.tdipu001.cvat  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cvat, Items.TaxCodePurchase, Items.Exception, DefaultFound)  
	  var.tdipu001.otbp  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.otbp, Items.BuyFromBusinessPartner, Items.Exception, DefaultFound)  
	  var.tdipu001.txtp  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.txtp, Items.TextIDPurchase, Items.Exception, DefaultFound)  
	  var.tdipu001.qual  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.qual, Items.Inspection, Items.Exception, DefaultFound, 2  	  )  	  'LN10605.n  
	   
'LN10605.sc  
'  	  If Items.ItemType  =  4 then  
	  If Items.ItemType  =  70 then  	   
'LN10605.ec  
	   	  var.tdipu001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.retw, 2, Items.Exception, DefaultFound, 1)  
	   	  var.tdipu001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cwar, "", Items.Exception, DefaultFound)  
	  else  
	   	  var.tdipu001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.retw, 1, Items.Exception, DefaultFound, 1)  
	   	  var.tdipu001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsPurchase.cwar, Items.Warehouse, Items.Exception, DefaultFound)  
	  end if  
	   
	  If Items.SupplyTime  <  "0" then  
	   	  'Set value to zero in case it is smaller than zero  
	   	  var.tdipu001.suti  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.suti, 0, Items.Exception, DefaultFound)  	   
	  else  	   
	   	  var.tdipu001.suti  =  ItemHandling.GetTypeNumber(ItemDefaultsPurchase.suti, Items.SupplyTime, Items.Exception, DefaultFound)  	   
	  end if  
	   
	  If Items.UnitforSupplyTime  =  "" then  
	   	  ' Set access value to 10 in case it is empty  
	   	  var.tdipu001.sutu  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sutu, 10, Items.Exception, DefaultFound, 10)  
	  Else  
	   	  var.tdipu001.sutu  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sutu, Items.UnitforSupplyTime, Items.Exception, DefaultFound, 10)  	   
	  End If  
	  var.tdipu001.sopr  =  set.source.of.price(Items.ItemType)  	  '  |  Fp9.n  
	  var.tdipu001.sopr  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sopr, var.tdipu001.sopr, Items.Exception, DefaultFound, 3)  
	   	   	   	   	   	   	   	   	   	   	  'LN10_4.sn  
	  var.tdipu001.sops  =  set.source.of.price.for.service.subcontracting(Items.ItemType)  
	  var.tdipu001.sops  =  ItemHandling.GetTypeEnum(ItemDefaultsPurchase.sopr, var.tdipu001.sops, Items.Exception, DefaultFound, 3)  
	   
	  var.tdipu001.prip  =  get.purchase.price(Items.ItemType, Items.PurchasePrice)  
	   	   	   	   	   	   	   	   	   	   	  'LN10_4.en  
	   
	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Sales Data (tdisa001)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  if DefaultsSales then  	   	   	   	   	   	  '  |  LN10605.n  
	   	  select  	  ItemDefaultsSales.*   
	   	  from  	  ItemDefaultsSales  
	   	  where  	  ItemDefaultsSales.kitm  =  varint.itemtype And ItemDefaultsSales.citg  =  varstr.itemgroup  
	   	  selectdo  
	   	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	   	  endselect  
	  end if  	   	   	   	   	   	   	  '  |  LN10605.n  
	  'Defaults presents but not in Item access table  	   
	  var.tdisa001.lmsp  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.lmsp, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.mnra  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.mnra, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.mmtl  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.mmtl, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.qidd  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qidd, 9999999.99, Items.Exception, DefaultFound)  
	  var.tdisa001.qimc  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qimc, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.qimo  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.qimo, 1, Items.Exception, DefaultFound)  
	  var.tdisa001.umsp  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.umsp, 0, Items.Exception, DefaultFound)  
	  var.tdisa001.cncd  =  ItemHandling.GetTypeString(ItemDefaultsSales.cncd, "", Items.Exception, DefaultFound)  
	  var.tdisa001.cmgp  =  ItemHandling.GetTypeString(ItemDefaultsSales.cmgp, "", Items.Exception, DefaultFound)  
	  var.tdisa001.cwar  =  ItemHandling.GetTypeString(ItemDefaultsSales.cwar, "", Items.Exception, DefaultFound)  
	  var.tdisa001.rbgp  =  ItemHandling.GetTypeString(ItemDefaultsSales.rbgp, "", Items.Exception, DefaultFound)  	   
	  var.tdisa001.bfbp  =  ItemHandling.GetTypeString(ItemDefaultsSales.bfbp, "", Items.Exception, DefaultFound)  	   	  '  |  LN10605.n  
	  var.tdisa001.stbp  =  ItemHandling.GetTypeString(ItemDefaultsSales.stbp, "", Items.Exception, DefaultFound)  	   	  '  |  LN10605.n  
	   
	  var.tdisa001.acci  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.acci, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.acom  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.acom, 0, Items.Exception, DefaultFound, 1)  
	  var.tdisa001.actn  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.actn, 0, Items.Exception, DefaultFound, 3)  
	  var.tdisa001.alod  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.alod, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.cphl  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.chpl, 0, Items.Exception, DefaultFound, 5)  	   
	  var.tdisa001.rcom  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.rcom, 0, Items.Exception, DefaultFound, 2)  
	  var.tdisa001.scon  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.scon, 0, Items.Exception, DefaultFound, 10)  
	  var.tdisa001.tltp  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.tltp, 0, Items.Exception, DefaultFound, 3)  
	  'Defaults presents and present in Item access table  
	  var.tdisa001.cpgs  =  ItemHandling.GetTypeString(ItemDefaultsSales.cpgs, Items.SalesPriceGroup, Items.Exception, DefaultFound)  
	  var.tdisa001.csgs  =  ItemHandling.GetTypeString(ItemDefaultsSales.csgs, Items.SalesStatisticsGroup, Items.Exception, DefaultFound)  
	  var.tdisa001.cups  =  ItemHandling.GetTypeString(ItemDefaultsSales.cups, Items.SalesPriceUnit, Items.Exception, DefaultFound)  
	  var.tdisa001.cuqs  =  ItemHandling.GetTypeString(ItemDefaultsSales.cuqs, Items.SalesUnit, Items.Exception, DefaultFound)  	   
	  var.tdisa001.cvat  =  ItemHandling.GetTypeString(ItemDefaultsSales.cvat, Items.TaxCodeSales, Items.Exception, DefaultFound)  
	  var.tdisa001.txts  =  ItemHandling.GetTypeNumber(ItemDefaultsSales.txts, Items.TextIDSales, Items.Exception, DefaultFound)  
	   
'LN10605.sc  
'Item Type Product or Generic  
'  	  if Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 then  
	  if Items.ItemType  =  30 or Items.ItemType  =  90 then  
'LN10605.ec  	   
	   	  var.tdisa001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.retw, 1, Items.Exception, DefaultFound, 2)  
	  else  
	   	  var.tdisa001.retw  =  ItemHandling.GetTypeEnum(ItemDefaultsSales.retw, 2, Items.Exception, DefaultFound, 2)  
	  end if  
	   
'  |   **********************************************************************************************   	   
'  |   *  Setting variables for Item Sales Data (tdisa001)  
'  |   **********************************************************************************************   	   
	  if Items.SalesPrice  <  "0" Then  
	   	  ' minimum price is 0  
	   	  var.tdisa001.pris  =  0  
	  Else  
	   	  var.tdisa001.pris  =  Items.SalesPrice  
	  end if  
	   
	  if Items.SuggestedRetailPrice  <  "0" then  
	   	  ' minimum price is 0  
	   	  var.tdisa001.prir  =  0  
	  Else  
	   	  var.tdisa001.prir  =  Items.SuggestedRetailPrice  
	  end if  
	   
'  |   ********************************************************************************************   
'  |  It default variables for Item Ordering Data (tcibd200)  
'  |   ********************************************************************************************   
	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  if DefaultsOrdering then  	   	   	   	   	   	  '  |  LN10605.n  
	   	  select  	  ItemDefaultsOrdering.*   
	   	  from  	  ItemDefaultsOrdering  
	   	  where  	  ItemDefaultsOrdering.kitm  =  varint.itemtype And ItemDefaultsOrdering.citg  =  varstr.itemgroup  
	   	  selectdo  
	   	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	   	  endselect  
	  end if  	   	   	   	   	   	   	  '  |  LN10605.n  	   	   
	  'Defaults presents but not in Item access table  	   
	  var.tcibd200.auso  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.auso, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.crmp  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.crmp, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.kctr  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.kctr, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.plpl  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.plpl, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tcibd200.ptyp  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.ptyp, 0, Items.Exception, DefaultFound, 3)  	   
	  var.tcibd200.uaoq  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.uaoq, 0, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.wpcs  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.wpcs, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	   
	  var.tcibd200.nopr  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.nopr, 1, Items.Exception, DefaultFound)  
	  var.tcibd200.ocst  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ocst, 0, Items.Exception, DefaultFound)  
	  var.tcibd200.serv  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.serv, 0, Items.Exception, DefaultFound)  
	  var.tcibd200.csps  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.csps, "", Items.Exception, DefaultFound)  
	  var.tcibd200.cspd  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cspd, "", Items.Exception, DefaultFound)  
	  var.tcibd200.cplb  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cplb, "", Items.Exception, DefaultFound)  
	  var.tcibd200.rgrp  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.rgrp, "", Items.Exception, DefaultFound)  
	  var.tcibd200.sfpl  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.sfpl, "", Items.Exception, DefaultFound)  
	  'Defaults presents and present in Item access table  
	  var.tcibd200.cwar  =  ItemHandling.GetTypeString(ItemDefaultsOrdering.cwar, Items.Warehouse, Items.Exception, DefaultFound)  	   
	  var.tcibd200.maxs  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maxs, Items.MaximumInventory, Items.Exception, DefaultFound)  	   
	  var.tcibd200.oint  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oint, Items.OrderInterval, Items.Exception, DefaultFound)  
	  var.tcibd200.reop  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.reop, Items.Reorderpoint, Items.Exception, DefaultFound)  
	  var.tcibd200.sftm  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.sftm, Items.SafetyTime, Items.Exception, DefaultFound)  
	  var.tcibd200.sfst  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.sfst, Items.SafetyStock, Items.Exception, DefaultFound)  
	  var.tcibd200.oivu  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.oivu, Items.OrderIntervalUnit, Items.Exception, DefaultFound, 10)  
	  var.tcibd200.omth  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.omth, Items.OrderMethod, Items.Exception, DefaultFound, 1)  
	  var.tcibd200.opol  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.opol, Items.OrderPolicy, Items.Exception, DefaultFound, 2)  
	  var.tcibd200.tuni  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.tuni, Items.SafetyTimeUnit, Items.Exception, DefaultFound, 10)  
'LN10605.sc  
'  	  If Items.OrderSystem  =  4 and Items.ItemType  <>  3 then  
	  If Items.OrderSystem  =  4 and Items.ItemType  <>  90 then  
'LN10605.ec  
	   	  var.tcibd200.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.osys, 9, Items.Exception, DefaultFound, 9)  
	  else  
	   	  var.tcibd200.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsOrdering.osys, Items.OrderSystem, Items.Exception, DefaultFound, 9)  
	  end if  
	  if (Items.OrderQuantityIncrement  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.oqmf  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oqmf, 0, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.oqmf  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.oqmf, Items.OrderQuantityIncrement, Items.Exception, DefaultFound)  
	  end if  	   
	  if (Items.MinimumOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.mioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.mioq, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.mioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.mioq, Items.MinimumOrderQuantity, Items.Exception, DefaultFound)  
	  end if  
	  if (Items.MaximumOrderQuantity  <=  "0") then  
	   	  var.tcibd200.maoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maoq, 9999999, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tcibd200.maoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.maoq, Items.MaximumOrderQuantity, Items.Exception, DefaultFound)  	   	   
	  End if  
	  If (Items.FixedOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.fioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.fioq, 1, Items.Exception, DefaultFound)  
	  else  
	   	  var.tcibd200.fioq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.fioq, Items.FixedOrderQuantity , Items.Exception, DefaultFound)  	   	   
	  end if  
	   
	  If (Items.EconomicOrderQuantity  <=  "0") then  
	   	  ' minimum value is 1  
	   	  var.tcibd200.ecoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ecoq, 1, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tcibd200.ecoq  =  ItemHandling.GetTypeNumber(ItemDefaultsOrdering.ecoq, Items.EconomicOrderQuantity, Items.Exception, DefaultFound)  
	  End if  
'  |   **********************************************************************************************   
'  |  Item default variables for Item Production Data (tiipd001)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  if DefaultsProduction then  	   	   	   	   	   	  '  |  LN10605.n  
	   	  select  	  ItemDefaultsProduction.*   
	   	  from  	  ItemDefaultsProduction  
	   	  where  	  ItemDefaultsProduction.kitm  =  varint.itemtype And ItemDefaultsProduction.citg  =  varstr.itemgroup  
	   	  selectdo  
	   	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	   	  endselect  
	  end if  	   	   	   	   	   	   	  '  |  LN10605.n  
	  'Defaults presents but not in Item access table  	   
	  var.tiipd001.pcrp  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.pcrp, 0, Items.Exception, DefaultFound)  
	  var.tiipd001.scdl  =  ItemHandling.GetTypeString(ItemDefaultsProduction.scdl, "", Items.Exception, DefaultFound)  
	  var.tiipd001.sfpl  =  ItemHandling.GetTypeString(ItemDefaultsProduction.sfpl, "", Items.Exception, DefaultFound)  	   	   |   *  LN1052.n  
	  var.tiipd001.rgrp  =  ItemHandling.GetTypeString(ItemDefaultsProduction.rgrp, "", Items.Exception, DefaultFound)  	   	   |   *  LN1052.n  
	  var.tiipd001.cick  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.cick, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.drin  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.drin, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.dris  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.dris, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.iuma  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.iuma, 0, Items.Exception, DefaultFound, 10)  
	  var.tiipd001.oqdr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oqdr, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.repi  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.repi, 0, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.smfs  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.smfs, 0, Items.Exception, DefaultFound, 2)  	   
	  var.tiipd001.swoc  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.swoc, 0, Items.Exception, DefaultFound, 1)  	   
	   
	  'Defaults presents and present in Item access table  
	  var.tiipd001.cpha  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.cpha, Items.Phantom, Items.Exception, DefaultFound, 2)  
	  var.tiipd001.phst  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.phst, Items.UsePhantomInventory, Items.Exception, DefaultFound, 2)  
	  If Items.BackflushIfMaterial  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfcp  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfcp,2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfcp  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfcp,Items.BackflushIfMaterial, Items.Exception, DefaultFound, 2)  
	  End If  
	  If Items.BackflushMaterials  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfep  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfep,2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfep  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfep,Items.BackflushMaterials, Items.Exception, DefaultFound, 2)  
	  End If  
	  If Items.BackflushHours  =  0 Then  
	   	  ' if not specified the value will be mapped with No  
	   	  var.tiipd001.bfhr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfhr, 2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.tiipd001.bfhr  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.bfhr,Items.BackflushHours, Items.Exception, DefaultFound, 2)  
	  End if  
	   	   	   
	  If Items.RoutingQuantity  <=  "0" Then  
	   	  'Minimum value is 1  
	   	  var.tiipd001.runi  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.runi, 1, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.runi  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.runi, Items.RoutingQuantity, Items.Exception, DefaultFound)  	   
	  End if  
	  If Items.BOMQuantity  <=  "0" then  
	   	  'Minimum value is 1  
	   	  var.tiipd001.unom  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.unom, 1, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.tiipd001.unom  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.unom, Items.BOMQuantity, Items.Exception, DefaultFound)  	   	   
	  End if  
	  If Items.ScrapFactor  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.scpf  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpf, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.scpf  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpf, Items.ScrapFactor, Items.Exception, DefaultFound)  
	  End if  
	  If Items.ScrapQuantity  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.scpq  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpq, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.tiipd001.scpq  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.scpq, Items.ScrapQuantity, Items.Exception, DefaultFound)  
	  End if  
	  If Items.OrderLeadTimeUnit  =  0 Then  
	   	  'If not defined than it will be mapped with hours (5)  
	   	  var.tiipd001.oltu  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oltu, 5 , Items.Exception, DefaultFound, 5)  
	  Else  
	   	  var.tiipd001.oltu  =  ItemHandling.GetTypeEnum(ItemDefaultsProduction.oltu,Items.OrderLeadTimeUnit, Items.Exception, DefaultFound, 5)  
	  End if  
	  If Items.OrderLeadTime  <  "0" then  
	   	  'Minimum value is 0  
	   	  var.tiipd001.oltm  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.oltm, 0, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.tiipd001.oltm  =  ItemHandling.GetTypeNumber(ItemDefaultsProduction.oltm, Items.OrderLeadTime, Items.Exception, DefaultFound)  
	  End if  	   
'  |   *  LN10605.so  
'  |   ***  Items Planning will be move to a new object. Cluster is now mandatory and a new access databse  
'  |   ***  table is now avaialable for planned items.  	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Planning Data (cprpd100)  
'  |   **********************************************************************************************   	   
'  	   
'  	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
'  	  if DefaultsPlanning then  	   	   	   	   	   	  '  |  LN10605.n  
'  	   	  select  	   	  ItemDefaultsPlanning.*   
'  	   	  from  	   	  ItemDefaultsPlanning  
'  	   	  where  	   	  ItemDefaultsPlanning.kitm  =  varint.itemtype And ItemDefaultsPlanning.citg  =  varstr.itemgroup  
'  	   	  selectdo  
'  	   	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
'  	   	  endselect  
'  	  end if  	   	   	   	   	   	   	  '  |  LN10605.n  
'  	  'Defaults presents but not in Item access table  	   
'  	  var.cprpd100.fite  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.fite, "", Items.Exception, DefaultFound)  
'  	  var.cprpd100.fide  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.fide, "", Items.Exception, DefaultFound)  
'  	  var.cprpd100.mrpu  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.mrpu, "", Items.Exception, DefaultFound)  
'  	  var.cprpd100.rpun  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.rpun, "", Items.Exception, DefaultFound)  
'  	  '  
'  	  var.cprpd100.audf  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.audf, 0, Items.Exception, DefaultFound, 1)  
'  	  var.cprpd100.auiv  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.auiv, 0, Items.Exception, DefaultFound, 1)  
'  	  var.cprpd100.aupr  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.aupr, 0, Items.Exception, DefaultFound, 1)  
'  	  var.cprpd100.aupu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.aupu, 0, Items.Exception, DefaultFound, 1)  
'  	  var.cprpd100.catp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.catp, 0, Items.Exception, DefaultFound, 2)  
'  	  var.cprpd100.chat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.chat, 0, Items.Exception, DefaultFound, 2)  
'  	  var.cprpd100.coat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.coat, 0, Items.Exception, DefaultFound, 2)  	   
'  	  var.cprpd100.cria  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.cria, 0, Items.Exception, DefaultFound, 2)  
'  	  var.cprpd100.depd  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.depd, 0, Items.Exception, DefaultFound, 2)  
'  	  var.cprpd100.deps  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.deps, 0, Items.Exception, DefaultFound, 1)  
'  	  var.cprpd100.efpg  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.efpg, 0, Items.Exception, DefaultFound, 2)  
'  	  var.cprpd100.fatp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.fatp, 0, Items.Exception, DefaultFound, 2)  
'  	  var.cprpd100.fica  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.fica, 0, Items.Exception, DefaultFound, 2)  
'  	  var.cprpd100.info  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.info, 0, Items.Exception, DefaultFound, 2)  
'  	  var.cprpd100.mult  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.mult, 0, Items.Exception, DefaultFound, 2)  
'  	  var.cprpd100.onat  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.onat, 0, Items.Exception, DefaultFound, 1)  
'  	  var.cprpd100.pbpl  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.pbpl, 0, Items.Exception, DefaultFound, 2)  
'  	  var.cprpd100.prio  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.prio, 0, Items.Exception, DefaultFound, 5)  
'  	  var.cprpd100.uatt  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.uatt, 0, Items.Exception, DefaultFound, 5)  
'  	  var.cprpd100.upho  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.upho, 0, Items.Exception, DefaultFound, 1)  
'  	  var.cprpd100.utmf  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.utmf, 0, Items.Exception, DefaultFound, 1)  
'  	  '  
'  	  var.cprpd100.atho  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.atho, 0, Items.Exception, DefaultFound)  
'  	  var.cprpd100.atta  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.atta, 0, Items.Exception, DefaultFound)  
'  	  var.cprpd100.attm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.attm, 0, Items.Exception, DefaultFound)  
'  	  var.cprpd100.fasi  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fasi, 0, Items.Exception, DefaultFound)  
'  	  var.cprpd100.fltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fltm, 9999, Items.Exception, DefaultFound)  
'  	  var.cprpd100.hoat  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.hoat, 0, Items.Exception, DefaultFound)  
'  	  var.cprpd100.inho  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.inho, 0, Items.Exception, DefaultFound)  
'  	  var.cprpd100.retf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.retf, 0, Items.Exception, DefaultFound)  
'  	  var.cprpd100.tfat  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tfat, 0, Items.Exception, DefaultFound)  
'  	  '  
'  	  'Defaults presents and present in Item access table  
'  	  var.cprpd100.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.osys,Items.MaintainMasterPlan, Items.Exception, DefaultFound, 2)  
'  	  var.cprpd100.crmp  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.crmp,Items.CriticalInMasterPlan, Items.Exception, DefaultFound, 2)  |   #  LN1052.n  
'  	  var.cprpd100.plvl  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.plvl, Items.PlanLevel, Items.Exception, DefaultFound)  
'  	  var.cprpd100.plid  =  ItemHandling.GetTypeString(ItemDefaultsPlanning.plid, Items.Planner, Items.Exception, DefaultFound)  
'  	  If Items.ExtraLeadTime  <  "0" then  
'  	   	  ' Mimimum value is 0  
'  	   	  var.cprpd100.eltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.eltm, 0, Items.Exception, DefaultFound)  
'  	  Else  	   
'  	   	  var.cprpd100.eltm  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.eltm, Items.ExtraLeadTime, Items.Exception, DefaultFound)  
'  	  End if  
'  	  If Items.ForecastTimeFence  <  "0" then  
'  	   	  ' Mimimum value is 0  
'  	   	  var.cprpd100.fctf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fctf, 0, Items.Exception, DefaultFound)  
'  	  Else  
'  	   	  var.cprpd100.fctf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.fctf, Items.ForecastTimeFence, Items.Exception, DefaultFound)  	   
'  	  End if  
'  	  If Items.TimeFence  <  "0" then  
'  	   	  ' Mimimum value is 0  
'  	   	  var.cprpd100.tmfc  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tmfc, 0, Items.Exception, DefaultFound)  
'  	  Else  
'  	   	  var.cprpd100.tmfc  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.tmfc, Items.TimeFence, Items.Exception, DefaultFound)  
'  	  End if  
'  	  If Items.UnitForExtraLeadTime  =  0 Then  
'  	   	  'If not defined than it will be mapped with days (10)  
'  	   	  var.cprpd100.eltu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.eltu,10, Items.Exception, DefaultFound, 10)  
'  	  Else  	   
'  	   	  var.cprpd100.eltu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.eltu,Items.UnitForExtraLeadTime, Items.Exception, DefaultFound, 10)  
'  	  End if  
'  	  If Items.TimeFenceUnit  =  0 then  
'  	   	  'If not defined than it will be mapped with days (10)  
'  	   	  var.cprpd100.tmfu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.tmfu,10, Items.Exception, DefaultFound, 10)  
'  	  Else  
'  	   	  var.cprpd100.tmfu  =  ItemHandling.GetTypeEnum(ItemDefaultsPlanning.tmfu,Items.TimeFenceUnit, Items.Exception, DefaultFound, 10)  
'  	  End if  
'  	  If Items.OrderHorizon  <=  "0" then  
'  	   	  If Items.MaintainMasterPlan  =  2 then  
'  	   	   	  'If Items.OrderHorizon is not specified it will be defaulted based upon MaintainMastesPlan.  
'  	   	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, 180, Items.Exception, DefaultFound)  
'  	   	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, 180, Items.Exception, DefaultFound)  
'  	   	  Else  
'  	   	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, 360, Items.Exception, DefaultFound)  
'  	   	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, 180, Items.Exception, DefaultFound)  
'  	   	  End if  	   	   	   
'  	  Else  
'  	   	  If Items.MaintainMasterPlan  =  2 then  
'  	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  
'  	   	  Else  
'  	   	   	  var.cprpd100.ptmf  =  Items.OrderHorizon  *  2  
'  	   	  End If  
'  	   	  var.cprpd100.otmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.otmf, Items.OrderHorizon, Items.Exception, DefaultFound)  	   	   
'  	   	  var.cprpd100.ptmf  =  ItemHandling.GetTypeNumber(ItemDefaultsPlanning.ptmf, var.cprpd100.ptmf, Items.Exception, DefaultFound)  
'  	  End if  
'  |   *  LN10605.eo  	   
	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Warehousing Data (whwmd400)  
'  |   **********************************************************************************************   	   	   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false '  
	  if DefaultsWarehousing then  	   	   	   	   	   	  '  |  LN10605.n  
	   	  select  	  ItemDefaultsWarehousing.*   
	   	  from  	  ItemDefaultsWarehousing  
	   	  where  	  ItemDefaultsWarehousing.kitm  =  varint.itemtype And ItemDefaultsWarehousing.citg  =  varstr.itemgroup  
	   	  selectdo  
	   	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true '  
	   	  endselect  
	  end if  	   	   	   	   	   	   	  '  |  LN10605.n  	   	   
	  'Defaults presents but not in Item access table  
	  var.whwmd400.cfmd  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.cfmd, "", Items.Exception, DefaultFound)  
	  var.whwmd400.pkdf  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.pkdf, "", Items.Exception, DefaultFound)  	   
	  var.whwmd400.rgtm  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.rgtm, "", Items.Exception, DefaultFound)  
	  var.whwmd400.risk  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.risk, "", Items.Exception, DefaultFound)  	   
	  var.whwmd400.ffsi  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.ffsi, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.npsl  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.npsl, 0, Items.Exception, DefaultFound)  	   
	  var.whwmd400.potc  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.potc, 0, Items.Exception, DefaultFound)  	   
	  var.whwmd400.qcma  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.qcma, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.qcmi  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.qcmi, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.txta, 0, Items.Exception, DefaultFound)  
	  var.whwmd400.ddlt  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.ddlt, 0, Items.Exception, DefaultFound) 'LN10_4.n'  
	  var.whwmd400.alle  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.alle, 0, Items.Exception, DefaultFound, 1)  
'  	  var.whwmd400.askp  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.askp, 0, Items.Exception, DefaultFound, 1)  	  'LN10605.o  
	  var.whwmd400.askp  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.askp, 0, Items.Exception, DefaultFound, 2)  	  'LN10605.n'  
	  var.whwmd400.assi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.assi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ccma  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ccma, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.coas  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.coas, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.cspr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.cspr, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ctzi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ctzi, 0, Items.Exception, DefaultFound, 5)  	   
	  var.whwmd400.dmsi  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsi, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmsp  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsp, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmsr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmsr, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dmss  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dmss, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.dwhs  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dwhs, 0, Items.Exception, DefaultFound, 70)  	   
	  var.whwmd400.dycd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.dycd, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.excc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.excc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.hama  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.hama, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.kpsl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.kpsl, 0, Items.Exception, DefaultFound, 4)  	   
	  var.whwmd400.lveh  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lveh, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.mabc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.mabc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.niwo  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.niwo, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.owip  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owip, 0, Items.Exception, DefaultFound, 20)  	   
	  var.whwmd400.owrl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owrl, 0, Items.Exception, DefaultFound, 10)  	   
	  var.whwmd400.owrt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.owrt, 0, Items.Exception, DefaultFound, 10)  	   
	  var.whwmd400.prva  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.prva, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.spri  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.spri, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.thus  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.thus, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.ufpl  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ufpl, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.uhnd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.uhnd, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.vers  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.vers, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.wmsc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.wmsc, 0, Items.Exception, DefaultFound, 2)  	   
	  var.whwmd400.rjha  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.rjha, 0, Items.Exception, DefaultFound, 10)  	  'LN10_4.sn '  
	  var.whwmd400.tmun  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.tmun, 0, Items.Exception, DefaultFound, 10)  
	  var.whwmd400.uidt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.uidt, 0, Items.Exception, DefaultFound, 10)  	  'LN10_4.en '  
	   
	  'Defaults presents and present in Item access table'  
	  var.whwmd400.usab  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.usab, Items.ExpectedAnnualIssue, Items.Exception, DefaultFound)  
	  var.whwmd400.ivgr  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.ivgr, Items.ItemValuationGroup, Items.Exception, DefaultFound)  
	  var.whwmd400.hama  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.hama, Items.HazardousMaterial, Items.Exception, DefaultFound, 2)  	  '  |   #  LN10605.n  
	  var.whwmd400.risk  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.risk, Items.ClassOfRisk, Items.Exception, DefaultFound)  	   	  '  |   #  LN10605.n  	   
	   
	  var.whwmd400.abcc  =  Ucase(Left(Items.Abcc, 1))  
	  var.whwmd400.abcc  =  ItemHandling.GetTypeString(ItemDefaultsWarehousing.abcc, var.whwmd400.abcc, Items.Exception, DefaultFound)  
	  if Items.FloorStock  =  0 Then  
	   	  'Use default value if not specified '  
	   	  var.whwmd400.pics  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.pics, 2, Items.Exception, DefaultFound, 2)  
	  Else  
	   	  var.whwmd400.pics  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.pics, Items.FloorStock, Items.Exception, DefaultFound, 2)  
	  end if  
	  if Items.InventoryCarryingCosts  <  "0" Then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.scst  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.scst, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.whwmd400.scst  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.scst, Items.InventoryCarryingCosts, Items.Exception, DefaultFound)  	   	   	   	   
	  End if  
	   
	  if Items.Height  <  "0" Then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.hght  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.hght, 0, Items.Exception, DefaultFound)  	   	   
	  Else  
	   	  var.whwmd400.hght  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.hght, Items.Height, Items.Exception, DefaultFound)  
	  end if  
	  if Items.Width  <  "0" Then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.wdth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.wdth, 0, Items.Exception, DefaultFound)  	   
	  Else  
	   	  var.whwmd400.wdth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.wdth, Items.Width, Items.Exception, DefaultFound)  
	  end if  
	  if Items.Depth  <  "0" then  
	   	  ' Mimimum value is 0 '  
	   	  var.whwmd400.dpth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.dpth, 0, Items.Exception, DefaultFound)  
	  Else  
	   	  var.whwmd400.dpth  =  ItemHandling.GetTypeNumber(ItemDefaultsWarehousing.dpth, Items.Depth, Items.Exception, DefaultFound)  	   	   
	  end if  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case of Outbound Method  
'  |   **********************************************************************************************   
	  if Items.OutboundMethod  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.obpr  =  2 ' FIFO  
	  end if  
'LN10605.sc  	   
'  	  If Items.ItemType  =  4 Then  
	  If Items.ItemType  =  70 Then  
'LN10605.ec  	   
	   	  'Set default values in case of cost items  
	   	  var.whwmd400.obpr  =  3 ' By Location  
	  end if  
	  var.whwmd400.obpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.obpr, var.whwmd400.obpr, Items.Exception, DefaultFound, 3)  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case of Location Controlled  
'  |   **********************************************************************************************   	   
	  if Items.LocationControlled  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.locc  =  1 ' Yes  
	  Else  
	   	  var.whwmd400.locc  =  Items.LocationControlled  
	  End if  
'LN10605.sc  	   
'  	  If Items.ItemType  =  4 Then  
	  If Items.ItemType  =  70 Then  
'LN10605.ec  	   	   
	   	  'Set default values in case of cost items  
	   	  var.whwmd400.locc  =  2 ' No  
	  End if  	   
	  var.whwmd400.locc  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.locc, var.whwmd400.locc, Items.Exception, DefaultFound, 1)  
'  |   **********************************************************************************************   	   	   
'  |  In case of Lot Controlled  
'  |   **********************************************************************************************   	   
	  If Items.LotPrice  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.ltpr  =  2 ' No  
	  Else  
	   	  var.whwmd400.ltpr  =  Items.LotPrice  	   
	  End if  
	  if Items.LotControlled  =  1 then  
	   	  if Items.LotsInInventory  =  1 then  
	   	   	  'Lot controlled and in inventory  
	   	   	  var.whwmd400.lttr  =  1 'Yes  
	   	   	  var.whwmd400.linv  =  1 'Yes  
	   	   	  var.whwmd400.ledd  =  3 'Not applicable  
	   	   	  var.whwmd400.ledr  =  3 'Not applicable  
	   	   	  var.whwmd400.ledt  =  3 'Not applicable  
	   	   	  var.whwmd400.lisf  =  3 'Not applicable  
	   	   	  var.whwmd400.lism  =  3 'Not applicable  
	   	  else  
	   	   	  'Lot controlled not in inventory  
	   	   	  var.whwmd400.lttr  =  1 'Yes  
	   	   	  var.whwmd400.linv  =  2 'No  
	   	   	  var.whwmd400.ledd  =  1 'Yes  
	   	   	  var.whwmd400.ledr  =  2 'No  
	   	   	  var.whwmd400.ledt  =  2 'No  
	   	   	  var.whwmd400.lisf  =  2 'No  
	   	   	  var.whwmd400.lism  =  2 'No  
	   	  end if  
	   	   
	  else  
	   	  'Not lot controlled  
	   	  var.whwmd400.ltpr  =  2 'No  
	   	  var.whwmd400.lttr  =  2 'No  
	   	  var.whwmd400.linv  =  2 'No  
	   	  var.whwmd400.ledd  =  3 'Not applicable  
	   	  var.whwmd400.ledr  =  3 'Not applicable  
	   	  var.whwmd400.ledt  =  3 'Not applicable  
	   	  var.whwmd400.lisf  =  3 'Not applicable  
	   	  var.whwmd400.lism  =  3 'Not applicable  
	  end if  
	   
	  var.whwmd400.ltpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ltpr, var.whwmd400.ltpr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.lttr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lttr, var.whwmd400.lttr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.linv  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.linv, var.whwmd400.linv, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.ledd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledd, var.whwmd400.ledd, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.ledr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledr, var.whwmd400.ledr, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.ledt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.ledt, var.whwmd400.ledt, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.lisf  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lisf, var.whwmd400.lisf, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.lism  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.lism, var.whwmd400.lism, Items.Exception, DefaultFound, 3)  
	   
'  |   **********************************************************************************************   	   	   
'  |  In case Serialized  
'  |   **********************************************************************************************   	   
	  If Items.SerialPrice  =  0 then  
	   	  'Use default value if not specified  
	   	  var.whwmd400.srpr  =  2 ' No  
	  Else  
	   	  var.whwmd400.srpr  =  Items.SerialPrice  	   
	  End if  
	  if Items.Serialized  =  1 then  
	   	  if Items.SerialsInInventory  =  1 then  
	   	   	  'Serialized and in inventory  
	   	   	  var.whwmd400.srtr  =  1 'Yes  
	   	   	  var.whwmd400.sinv  =  1 'Yes  
	   	   	  var.whwmd400.sedd  =  3 'Not applicable  
	   	   	  var.whwmd400.sedr  =  3 'Not applicable  
	   	   	  var.whwmd400.sedt  =  3 'Not applicable  
	   	   	  var.whwmd400.sisf  =  3 'Not applicable  
	   	   	  var.whwmd400.sism  =  3 'Not applicable  
	   	  else  
	   	   	  'Serialized not in inventory  
	   	   	  var.whwmd400.srtr  =  1 'Yes  
	   	   	  var.whwmd400.sinv  =  2 'No  
	   	   	  var.whwmd400.sedd  =  1 'Yes  
	   	   	  var.whwmd400.sedr  =  2 'No  
	   	   	  var.whwmd400.sedt  =  2 'No  
	   	   	  var.whwmd400.sisf  =  2 'No  
	   	   	  var.whwmd400.sism  =  2 'No  
	   	  end if  
	  else  
	   	  ' Not serialized  
	   	  var.whwmd400.srpr  =  2 'No  
	   	  var.whwmd400.srtr  =  2 'No  
	   	  var.whwmd400.sinv  =  2 'No  
	   	  var.whwmd400.sedd  =  3 'Not applicable  
	   	  var.whwmd400.sedr  =  3 'Not applicable  
	   	  var.whwmd400.sedt  =  3 'Not applicable  
	   	  var.whwmd400.sisf  =  3 'Not applicable  
	   	  var.whwmd400.sism  =  3 'Not applicable  
	  end if  
	   
	  var.whwmd400.srpr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.srpr, var.whwmd400.srpr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.srtr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.srtr, var.whwmd400.srtr, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.sinv  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sinv, var.whwmd400.sinv, Items.Exception, DefaultFound, 2)  
	  var.whwmd400.sedd  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedd, var.whwmd400.sedd, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sedr  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedr, var.whwmd400.sedr, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sedt  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sedt, var.whwmd400.sedt, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sisf  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sisf, var.whwmd400.sisf, Items.Exception, DefaultFound, 3)  
	  var.whwmd400.sism  =  ItemHandling.GetTypeEnum(ItemDefaultsWarehousing.sism, var.whwmd400.sism, Items.Exception, DefaultFound, 3)  
	   	   	   	   	   	   	   	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item service Data (tsmdm200)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  if DefaultsService then  	   	   	   	   	   	  '  |  LN10605.n  
	   	  select  	  ItemDefaultsService.*   
	   	  from  	  ItemDefaultsService  
	   	  where  	  ItemDefaultsService.kitm  =  varint.itemtype And ItemDefaultsService.citg  =  varstr.itemgroup  
	   	  selectdo  
	   	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	   	  endselect  
	  end if  	   	   	   	   	   	   	  '  |  LN10605.n  
	   	   
	  'Defaults presents but not in Item access table  	   
	  var.tsmdm200.acos  =  ItemHandling.GetTypeEnum(ItemDefaultsService.acos, 0, Items.Exception, DefaultFound, 70)  
	  var.tsmdm200.cinc  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cinc, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tsmdm200.cmtc  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cmtc, 0, Items.Exception, DefaultFound, 20)  
	  var.tsmdm200.cmts  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cmts, 0, Items.Exception, DefaultFound, 20)  
	  var.tsmdm200.cvco  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cvco, 0, Items.Exception, DefaultFound, 15)  	   
	  var.tsmdm200.cpit  =  ItemHandling.GetTypeEnum(ItemDefaultsService.cpit, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tsmdm200.dltp  =  ItemHandling.GetTypeEnum(ItemDefaultsService.dltp, 0, Items.Exception, DefaultFound, 4)  
	  var.tsmdm200.dtps  =  ItemHandling.GetTypeEnum(ItemDefaultsService.dtps, 0, Items.Exception, DefaultFound, 10)  
	  var.tsmdm200.owns  =  ItemHandling.GetTypeEnum(ItemDefaultsService.owns, 0, Items.Exception, DefaultFound, 10)  	  'LN10_4.n  
	  var.tsmdm200.rmcr  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rmcr, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rmsr  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rmsr, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rncw  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rncw, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rpyn  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rpyn, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.rwun  =  ItemHandling.GetTypeEnum(ItemDefaultsService.rwun, 0, Items.Exception, DefaultFound, 5)  
	  var.tsmdm200.scir  =  ItemHandling.GetTypeEnum(ItemDefaultsService.scir, 0, Items.Exception, DefaultFound, 2)  	  'LN10_4.n  
	  var.tsmdm200.sirq  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sirq, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.sswt  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sswt, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.sttp  =  ItemHandling.GetTypeEnum(ItemDefaultsService.sttp, 0, Items.Exception, DefaultFound, 15)  	  'LN10_4.n  
	  var.tsmdm200.uval  =  ItemHandling.GetTypeEnum(ItemDefaultsService.uval, 0, Items.Exception, DefaultFound, 2)  
	  var.tsmdm200.blag  =  ItemHandling.GetTypeString(ItemDefaultsService.blag, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ccds  =  ItemHandling.GetTypeString(ItemDefaultsService.ccds, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ccme  =  ItemHandling.GetTypeString(ItemDefaultsService.ccme, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.ckgr  =  ItemHandling.GetTypeString(ItemDefaultsService.ckgr, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cmea  =  ItemHandling.GetTypeString(ItemDefaultsService.cmea, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cmpo  =  ItemHandling.GetTypeString(ItemDefaultsService.cmpo, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cogr  =  ItemHandling.GetTypeString(ItemDefaultsService.cogr, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.cwte  =  ItemHandling.GetTypeString(ItemDefaultsService.cwte, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.gwte  =  ItemHandling.GetTypeString(ItemDefaultsService.gwte, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.peru  =  ItemHandling.GetTypeString(ItemDefaultsService.peru, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.prun  =  ItemHandling.GetTypeString(ItemDefaultsService.prun, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.sbct  =  ItemHandling.GetTypeString(ItemDefaultsService.sbct, "", Items.Exception, DefaultFound)  
	  var.tsmdm200.scme  =  ItemHandling.GetTypeString(ItemDefaultsService.scme, "", Items.Exception, DefaultFound)  	   	  'LN10_4.n  
	  var.tsmdm200.smpo  =  ItemHandling.GetTypeString(ItemDefaultsService.smpo, "", Items.Exception, DefaultFound)  	   	  'LN10_4.n  
	  var.tsmdm200.swte  =  ItemHandling.GetTypeString(ItemDefaultsService.swte, "", Items.Exception, DefaultFound)  
	  var_tsmdm200_mepo  =  ItemHandling_GetTypeString(ItemDefaultsService_mepo, "", Items_Exception, DefaultFound)  	   	   	   	  '  |   #  LN10605.n  
	   
'  |   	  var.tsmdm200.mepo  =  ItemHandling.GetTypeNumber(ItemDefaultsService.mepo, 0, Items.Exception, DefaultFound)  	   	   	   	  '  |   #  LN10605.o  
	  var.tsmdm200.nrpe  =  ItemHandling.GetTypeNumber(ItemDefaultsService.nrpe, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.rwdu  =  ItemHandling.GetTypeNumber(ItemDefaultsService.rwdu, 0, Items.Exception, DefaultFound)  
	  var.tsmdm200.srpd  =  ItemHandling.GetTypeNumber(ItemDefaultsService.srpd, 0, Items.Exception, DefaultFound)  
	   
	  'Defaults presents and present in Item access table  
	  var.tsmdm200.ccur  =  ItemHandling.GetTypeString(ItemDefaultsService.ccur, Items.ServiceCurrency, Items.Exception, DefaultFound)  
	  var.tsmdm200.cups  =  ItemHandling.GetTypeString(ItemDefaultsService.cups, Items.SalesUnit, Items.Exception, DefaultFound)  
	  var.tsmdm200.cuqs  =  ItemHandling.GetTypeString(ItemDefaultsService.cuqs, Items.SalesUnit, Items.Exception, DefaultFound)  
	  var.tsmdm200.cwoc  =  ItemHandling.GetTypeString(ItemDefaultsService.cwoc, Items.ServiceDepartment, Items.Exception, DefaultFound)  
'  |   	  var.tsmdm200.sigr  =  ItemHandling.GetTypeString(ItemDefaultsService.sigr, Items.SerializedItemGroup, Items.Exception, DefaultFound)  	   	  '  |   #  LN10605.o  
	  var.tsmdm200.csgr  =  ItemHandling.GetTypeString(ItemDefaultsService.csgr, Items.ServiceItemGroup, Items.Exception, DefaultFound)  	   	  '  |   #  LN10605.n  
	  var.tsmdm200.pris  =  ItemHandling.GetTypeNumber(ItemDefaultsService.pris, Items.ServicePrice, Items.Exception, DefaultFound)  
	   
'  |   **********************************************************************************************   	   	   
'  |   *  Setting variables for Item Service Data (tsmdm200)  
'  |   **********************************************************************************************   	   
	  If Items.ConfigurationControlled  <>  1 then  
'  |   	   	  var.tsmdm200.csgr  =  ItemHandling.GetTypeString(ItemDefaultsService.csgr, "", Items.Exception, DefaultFound)  	   	   	  '  |   #  LN10605.o  	   
	   	  var.tsmdm200.sigr  =  ItemHandling.GetTypeString(ItemDefaultsService.sigr, "", Items.Exception, DefaultFound)  	   	   	  '  |   #  LN10605.n  
	  Else  
'  |   	   	  var.tsmdm200.csgr  =  ItemHandling.GetTypeString(ItemDefaultsService.csgr, Items.ServiceItemGroup, Items.Exception, DefaultFound)  	  '  |   #  LN10605.o  
	   	  var.tsmdm200.sigr  =  ItemHandling.GetTypeString(ItemDefaultsService.sigr, Items.SerializedItemGroup, Items.Exception, DefaultFound)  	  '  |   #  LN10605.n  
	  End if  
	   
	  If Items.ConfigurationControlled  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tsmdm200.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsService.seri, 0, Items.Exception, DefaultFound, 3)  	   
	  Else  
	   	  var.tsmdm200.seri  =  ItemHandling.GetTypeEnum(ItemDefaultsService.seri, Items.ConfigurationControlled, Items.Exception, DefaultFound, 3)  	   
	  End If  
	   	   
'  |   **********************************************************************************************   
'  |  Item default variables for Item Project Data (tppdm005)  
'  |   **********************************************************************************************   
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  if DefaultsProject then  	   	   	   	   	   	  '  |  LN10605.n  
	   	  select  	  ItemDefaultsProject.*   
	   	  from  	  ItemDefaultsProject  
	   	  where  	  ItemDefaultsProject.kitm  =  varint.itemtype And ItemDefaultsProject.citg  =  varstr.itemgroup  
	   	  selectdo  
	   	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	   	  endselect  
	  end if  	   	   	   	   	   	   	  '  |  LN10605.n  
	   	   
	  'Defaults presents but not in Item access table  
	  var.tppdm005.txta  =  ItemHandling.GetTypeNumber(ItemDefaultsProject.txta, 0, Items.Exception, DefaultFound)  
	  'Defaults presents and present in Item access table  	   
	  var.tppdm005.ccur  =  ItemHandling.GetTypeString(ItemDefaultsProject.ccur, Items.CostPriceCurrency, Items.Exception, DefaultFound)  
	   
	  If Items.ControlFunction  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.ccfu  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.ccfu, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.ccfu  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.ccfu, Items.ControlFunction, Items.Exception, DefaultFound, 1)  
	  End If  	   
	   	   
	  If Items.ProjectOrderSystem  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, 0, Items.Exception, DefaultFound, 9)  
	  Else  	   
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, Items.ProjectOrderSystem, Items.Exception, DefaultFound, 9)  
	  End If  
	   
	  If Item.PricePolicy  =  0 Then  
	   	  'Use default value if not specified  	   
	   	  var.tppdm005.cppp  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.cppp, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.cppp  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.cppp, Item.PricePolicy, Items.Exception, DefaultFound, 1)  
	  End if  	   	   
	   
	  If Items.ProjectOrderSystem  =  0 Then  
	   	  'Use default value if not specified  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, 0, Items.Exception, DefaultFound, 9)  
	  Else  
	   	  var.tppdm005.osys  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.osys, Items.ProjectOrderSystem, Items.Exception, DefaultFound, 9)  
	  End if  	   
	   	   
	  If Items.RegisterProgress  =  0 Then  
	   	  'Use default value if not specified  	   
	   	  var.tppdm005.prre  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.prre, 0, Items.Exception, DefaultFound, 1)  
	  Else  
	   	  var.tppdm005.prre  =  ItemHandling.GetTypeEnum(ItemDefaultsProject.prre, Items.RegisterProgress, Items.Exception, DefaultFound, 1)  	   
	  End If  
	   
	  var.tppdm005.ccit  =  get.segment.item.code(Items.CCItemProjectSegment, Items.CCItemItemSegment)  
	  var.tppdm005.ccit  =  ItemHandling.GetTypeString(ItemDefaultsProject.ccit, var.tppdm005.ccit, Items.Exception, DefaultFound)  	   
	   
	   
'  |   **********************************************************************************************   	   
'  |   *  Actual Dump Section  
'  |   **********************************************************************************************   	   
	  dump 001 '  |   *  Dump for tcibd001  
	  dump 400 '  |   *  Dump for whwmd400  
	   
	  if Items.ItemPurchaseData  <>  2 then  
	   	  dump 002 '  |   *  Dump for tdipu001  
	   	  dump 102 '  |   *  Dump for tdipu100  
	  end if  
	   
	  if Items.ItemSalesData  <>  2 then  
	   	  dump 003 '  |   *  Dump for tdisa001  
	  end if  
'LN10605.sc  	   
'  	  if Items.ItemProductionData  <>  2 and _  
'  	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5) then  
	  if Items.ItemProductionData  <>  2 and _  
	  (Items.ItemType  =  30 or Items.ItemType  =  80 or Items.ItemType  =  90) then  	   
	   	  dump 004 '  |   *  Dump for tiipd001  
	  end if  
'LN10605.so  
'  *  Moved to seperate object for Item Costing data by Enterprise Unit  	   
'  	  if Items.ItemType  <>  6 and Items.ItemType  <>  10 then  
'  	   	  'dump007 '  |   *  Dump for ticpr007  
'  	  end if  
'LN10605.eo  	   
	  ' if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  10) then  	   	   	   	   	  'LN10605.so  
	  '  	  dump100 '  |   *  Dump for tcibd100  	   	  ' table obsolete in LN1060.  
	  ' end if  	   	   	   	   	   	   	   	   	   	   	   	  'LN10605.eo  
'LN10605.so  
'  *  Moved to seperate object for Item PLanning data by cluster  
'  	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  5 or Items.ItemType  =  10) then  
'  	   	  cluster.found  =  0  
'  	   	  If varstr.cprj  =  "" or IsNUll(varstr.cprj) then  
'  	   	   	  select  	  ItemsByCluster.*   
'  	   	   	  from  	  ItemsByCluster  
'  	   	   	  where  	  (ItemsByCluster.Project  =  "" and ItemsByCluster.Item  =  varstr.item)  
'  	   	   	  selectdo  
'  	   	   	   	  cluster.found  =  1  
'  	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
'  	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	   
'  	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	   
'  	   	   	   	  ' dump101 '  |   *  Dump for cprpd100  |   #  Moved to own script  
'  	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
'  	   	   	   	  ' dump120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
'  	   	   	  endselect  
'  	   	  Else  
'  	   	   	  select  	  ItemsByCluster.*   
'  	   	   	  from  	  ItemsByCluster  
'  	   	   	  where  	  (ItemsByCluster.Project  =  varstr.cprj and ItemsByCluster.Item  =  varstr.item)  
'  	   	   	  selectdo  
'  	   	   	   	  cluster.found  =  1  
'  	   	   	   	  var.planned.item  =  get.segment.cp.item.code(ItemsByCluster.Cluster,varstr.cprj,varstr.item)  
'  	   	   	   	  var.cprpd100.cwar  =  ItemsByCluster.Warehouse  	   	   
'  	   	   	   	  var.cprpd100.sour  =  ItemsByCluster.SupplySource  	   	   
'  	   	   	   	  ' dump101 '  |   *  Dump for cprpd100  |   #  Moved to own script  
'  	   	   	   	  PlanItemCode  =  PlanItemCode  +  1  
'  	   	   	   	  'dump120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
'  	   	   	  endselect  
'  	   	  End If  	   	   
'  	   	  if cluster.found  =  0 then  
'  	   	   	  varstr.clus  =  "   "  	   	   
'  	   	   	  var.planned.item  =  get.segment.cp.item.code(varstr.clus,varstr.cprj,varstr.item)  
'  	   	   	  var.cprpd100.cwar  =  Items.Warehouse  	   	   	   
'  	   	   	  var.cprpd100.sour  =  1  	   	   	   	   	   
'  	   	   	  ' dump101 '  |   *  Dump for cprpd100  |   #  Moved to own script  
'  	   	   	  PlanItemCode  =  PlanItemCode  +  1  
'  	   	   	  ' dump120 '  |   *  Dump for cprpd120  |   #  FP9 table obsolete  
'  	   	  end if  
'  	   	  dump 200 '  |   *  Dump for tcibd200  
'  	  end if  
'LN10605.eo.sn  
	   	  if (Items.ItemType  =  30 or Items.ItemType  =  80 or Items.ItemType  =  90) then  
	   	   	  dump 200 '  |   *  Dump for tcibd200  
	   	  end if  
'LN10605.en  	   
'LN10605.sc  
'  	  if Items.ItemServiceData  <>  2 and _  
'  	   	  (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  
	  if Items.ItemServiceData  <>  2 and _  
	   	  (Items.ItemType  =  30 or Items.ItemType  =  70 or Items.ItemType  =  80 or Items.ItemType  =  90) then  	   	   
'LN10605.ec  	   	   
	   	   	  dump 201 '  |   *  Dump for tsmdm200  
	  end if  
'LN10605.sc  	   
'  	  if Items.ItemProjectData  <>  2 then  
'  	   	  if (Items.ItemType  =  1 or Items.ItemType  =  2 or Items.ItemType  =  3 or Items.ItemType  =  4 or Items.ItemType  =  5) then  
	  if Items.ItemProjectData  <>  2 then  
	   	  if (Items.ItemType  =  30 or Items.ItemType  =  70 or Items.ItemType  =  80 or Items.ItemType  =  90) then  
'LN10605.ec  	   	   	   
	   	   	  dump 005 '  |   *  Dump for tppdm005  
	   	  end if  
	  end if  
	   
'LN10605.sn  
	   	  if Items.ItemType  =  40 then  
	   	   	   	  dump 401 '  |   *  Dump for titrp001  
	   	  end if  
'LN10605.en  	   	
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:S
:QURY:START
select  	   	  Items.*
from 	   	  Items
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Items
:ICOD:X
:QURY:START
'  |   **********************************************************************************************   	   
'  |  Restructured the script for the implementation of the item defaulting.  
'  |   	   
'  |  Cleaned Source for the below solutions and marking related to previous FP version  <  9  
'  |   -  243214  
'  |   -  244255  
'  |   -  244268  
'  |   -  244355  
'  |   -  249608  
'  |   **********************************************************************************************
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:D
:QURY:START
	  dump 64 '  |  PE to tcibd001  
	  dump 65 '  |  PE to tdipu001  
	  dump 66 '  |  PE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:S
:QURY:START
select ProjectEquipments.*
from ProjectEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:D
:QURY:START
	  if ProjectSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  ProjectSubcontractings.cuti  
	  end if  
	  dump 74 '  |   *  PS to tcibd001  
	  dump 75 '  |   *  PS to tdipu001  
	  dump 76 '  |   *  PS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:S
:QURY:START
select ProjectSubcontractings.*
from ProjectSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:D
:QURY:START
	  if StandardEquipments.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 61 '  |   *  SE to tcibd001  
	  dump 62 '  |   *  SE to tdipu001  
	  dump 63 '  |   *  SE to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:S
:QURY:START
select StandardEquipments.*
from StandardEquipments
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardEquipments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:D
:QURY:START
	  if StandardSubcontractings.dsbc  =  1 then  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuni  
	  else  
	   	  var.subcontracting.inv.unit  =  StandardSubcontractings.cuti  
	  end if  
	  if StandardSubcontractings.psiu  =  1 then  
	   	  var.tcibd001.styp  =  3  
	  else  	   
	   	  var.tcibd001.styp  =  1  
	  end if  
	  dump 71 '  |   *  SS to tcibd001  
	  dump 72 '  |   *  SS to tdipu001  
	  dump 73 '  |   *  SS to tdisa001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:S
:QURY:START
select StandardSubcontractings.*
from StandardSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:003
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ConversionFactorsByItem
:ICOD:D
:QURY:START
	  var.tcibd003.item  =  get.segment.item.code(ConversionFactorsByItem.Project, ConversionFactorsByItem.Item)  
	  var.tcibd003.citg  =  ""  
	  dump 003 '  |   *  tcibd003
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:003
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ConversionFactorsByItem
:ICOD:S
:QURY:START
select  	  ConversionFactorsByItem.*
from 	  ConversionFactorsByItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:003
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ConversionFactorsByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:003
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ConversionFactorsByItemGroup
:ICOD:D
:QURY:START
	  var.tcibd003.item  =  ""  
	  var.tcibd003.citg  =  ConversionFactorsByItemGroup.ItemGroup  
'A2LN_1061.sc New dump because of table split  
'  	  dump 003 '  |   *  tcibd003  
	  dump 004 '  |   *  tcibd003 Item Group
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:003
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ConversionFactorsByItemGroup
:ICOD:S
:QURY:START
select  	  ConversionFactorsByItemGroup.*
from 	  ConversionFactorsByItemGroup
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:003
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ConversionFactorsByItemGroup
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:150
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsByOffice
:ICOD:D
:QURY:START
	  var.itemcode  =  get.segment.item.code(ItemsByOffice.Project,ItemsByOffice.Item)  
	  if ItemsByOffice.OfficeType  =  10 then  
	   	  if ItemsByOffice.PurchaseStatsGroup  <>  "" then  
	   	   	  tdipu081.csgp  =  ItemsByOffice.PurchaseStatsGroup  
	   	  else  
	   	   	  tdipu081.csgp  =  Items.PurchaseStatisticsGroup  
	   	  end if  
	   	  if ItemsByOffice.PurchaseTaxCode  <>  "" then  
	   	   	  tdipu081.cvat  =  ItemsByOffice.PurchaseTaxCode  
	   	  else  
	   	   	  tdipu081.cvat  =  Items.TaxCodePurchase  
	   	  end if  
	   	  dump 11 '  |   *  tdipu081 Office  
	  end if  
	  if ItemsByOffice.OfficeType  =  20 then  
	   	  var.tdisa081.ugis  =  target(tcyesno.yes)  
	   	  if ItemsByOffice.Unit  <>  "" then  
	   	   	  var.tdisa081.cuqs  =  ItemsByOffice.Unit  
	   	   	  var.tdisa081.ugis  =  target(tcyesno.no)  
	   	  else  
	   	   	  var.tdisa081.cuqs  =  Items.SalesUnit  
	   	  end if  
	   	  if ItemsByOffice.PriceUnit  <>  "" then  
	   	   	  var.tdisa081.cups  =  ItemsByOffice.PriceUnit  
	   	   	  var.tdisa081.ugis  =  target(tcyesno.no)  
	   	  else  
	   	   	  var.tdisa081.cups  =  Items.SalesPriceUnit  
	   	  end if  
	   	  if ItemsByOffice.Price  <>  "0" then  
	   	   	  var.tdisa081.pris  =  ItemsByOffice.Price  
	   	   	  var.tdisa081.ugis  =  target(tcyesno.no)  
	   	  else  
	   	   	  var.tdisa081.pris  =  Items.SalesPrice  
	   	  end if  
	   	  dump 12 '  |   *  tdisa081 Office  
	  end if  
	  if ItemsByOffice.OfficeType  =  30 then  
	   	  var.tsmdm220.ugis  =  target(tcyesno.no)  
	   	  if ItemsByOffice.Unit  <>  "" then  
	   	   	  var.tsmdm220.cuqs  =  ItemsByOffice.Unit  
	   	  else  
	   	   	  var.tsmdm220.cuqs  =  Items.SalesUnit  
	   	  end if  
	   	  if ItemsByOffice.PriceUnit  <>  "" then  
	   	   	  var.tsmdm220.cups  =  ItemsByOffice.PriceUnit  
	   	  else  
	   	   	  var.tsmdm220.cups  =  Items.SalesPriceUnit  
	   	  end if  
	   	  if ItemsByOffice.Price  <>  "0" then  
	   	   	  var.tsmdm220.pris  =  ItemsByOffice.Price  
	   	  else  
	   	   	  var.tdisa081.pris  =  Items.ServicePrice  
	   	  end if  
	   	  if ItemsByOffice.Currency  <>  "" then  
	   	   	  var.tsmdm220.ccur  =  ItemsByOffice.Currency  
	   	  else  
	   	   	  var.tsmdm220.ccur  =  Items.ServiceCurrency  
	   	  end if  	   	   	   
	   	  dump 13 '  |   *  tsmdm220 Office  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:150
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsByOffice
:ICOD:S
:QURY:START
select  	  ItemsByOffice.*  , Items.*
from 	  ItemsByOffice, Items
where 	  ItemsByOffice.Project  =  Items.Project  
and  	  ItemsByOffice.Item  =  Items.Item
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:150
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsByOffice
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:150
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsBySite
:ICOD:D
:QURY:START
	  var.itemcode  =  get.segment.item.code(ItemsBySite.Project,ItemsBySite.Item)  
	  dump 001 '  |   *  tcibd150 Site  
	  if ItemsBySite.ItemOrdering  =  1 then  
	   	  dump 002 '  |   *  tcibd250 Site  
	  end if  
	  if ItemsBySite.ItemPurchase  =  1 then  
	   	  var.tdipu081.ugip  =  target(tcyesno.yes)  
	   	  if ItemsBySite.PurchasePrice  <>  "0" then  
	   	   	  var.tdipu081.prip  =  ItemsBySite.PurchasePrice  
	   	   	  var.tdipu081.ugip  =  target(tcyesno.no)  
	   	  else  
	   	   	  var.tdipu081.prip  =  Items.PurchasePrice  
	   	  end if  
	   	  if ItemsBySite.PurchaseUnit  <>  "" then  
	   	   	  var.tdipu081.cuqp  =  ItemsBySite.PurchaseUnit  
	   	   	  var.tdipu081.ugip  =  target(tcyesno.no)  
	   	  else  
	   	   	  var.tdipu081.cuqp  =  Items.PurchaseUnit  
	   	  end if  
	   	  if ItemsBySite.PurchasePriceUnit  <>  "" then  
	   	   	  var.tdipu081.cupp  =  ItemsBySite.PurchasePriceUnit  
	   	   	  var.tdipu081.ugip  =  target(tcyesno.no)  
	   	  else  
	   	   	  var.tdipu081.cupp  =  Items.PurchasePriceUnit  
	   	  end if  
	   	  if ItemsBySite.SitePurchaseOffice  <>  "" then  
	   	   	  var.tdipu081.cofc  =  ItemsBySite.SitePurchaseOffice  
	   	   	  var.tdipu081.ugip  =  target(tcyesno.no)  
	   	  else  
	   	   	  var.tdipu081.cofc  =  Items.PurchaseOffice  
	   	  end if  
	   	  if ItemsBySite.PurchaseWarehouse  <>  "" then  
	   	   	  var.tdipu081.cwar  =  ItemsBySite.PurchaseWarehouse  
	   	  else  
	   	   	  var.tdipu081.cwar  =  Items.Warehouse  
	   	  end if  
	   	  if ItemsBySite.PurchaseCurrency  <>  "" then  
	   	   	  var.tdipu081.ccur  =  ItemsBySite.PurchaseCurrency  
	   	  else  
	   	   	  var.tdipu081.ccur  =  Items.PurchaseCurrency  
	   	  end if  
	   	  if ItemsBySite.PurchaseBuyFromBP  <>  "" then  
	   	   	  var.tdipu081.otbp  =  ItemsBySite.PurchaseBuyFromBP  
	   	  else  
	   	   	  var.tdipu081.otbp  =  Items.BuyFromBusinessPartner  
	   	  end if  
	   	  if ItemsBySite.Buyer  <>  "" then  
	   	   	  var.tdipu081.buyr  =  ItemsBySite.Buyer  
	   	  else  
	   	   	  var.tdipu081.buyr  =  Items.Buyer  
	   	  end if  
	   	  if ItemsBySite.SupplyTime  <>  "0" then  
	   	   	  var.tdipu081.suti  =  ItemsBySite.SupplyTime  
	   	  else  
	   	   	  var.tdipu081.suti  =  Items.SupplyTime  
	   	  end if  	   	   
	   	  if Items.ItemType  =  70 then  
	   	   	  var.tdipu081.retw  =  target(tcyesno.no)  
	   	  else  
	   	   	  var.tdipu081.retw  =  target(tcyesno.yes)  
	   	  end if  
	   	  var.tdipu081.sopr  =  set.source.of.price(Items.ItemType)  
	   	  var.tdipu081.sops  =  set.source.of.price.for.service.subcontracting(Items.ItemType)  
	   	  dump 003 '  |   *  tdipu081 Site  
	  end if  
	  if ItemsBySite.ItemSales  =  1 then  
	   	  if ItemsBySite.SalesWarehouse  <>  "" then  
	   	   	  var.tdisa081.cwar  =  ItemsBySite.SalesWarehouse  
	   	  else  
	   	   	  var.tdisa081.cwar  =  Items.Warehouse  
	   	  end if  
	   	  dump 004 '  |   *  tdisa081 Site  
	  end if  
	  if ItemsBySite.ItemProduction  =  1 then  
	   	  dump 005 '  |   *  tiipd051 Site  
	  end if  
	  if ItemsBySite.ItemService  =  1 then  
	   	  dump 006 '  |   *  tsmdm220 Site  
	  end if  
	  if ItemsBySite.ItemWarehousing  =  1 then  
	   	  if Items.SearchKeyI  <>  "" then  
	   	   	  var.whwmd404.seak  =  UCase(Left(Items.SearchKeyI, 16))  
	   	  else  
	   	   	  var.whwmd404.seak  =  UCase(Left(Items.ItemDescription, 16))  
	   	  end if  
	   	  If Items.ItemType  =  4 Then  
	   	   	  var.whwmd404.locc  =  2 ' No  
	   	  else  
	   	   	  var.whwmd404.locc  =  Items.LocationControlled  
	   	  end if  
	   	  if Items.LotControlled  =  1 then  
	   	   	  if Items.LotsInInventory  =  1 then  
	   	   	   	  'Lot controlled and in inventory  
	   	   	   	  var.whwmd404.lttr  =  1 'Yes  
	   	   	   	  var.whwmd404.linv  =  1 'Yes  
	   	   	   	  var.whwmd404.ledd  =  3 'Not applicable  
	   	   	   	  var.whwmd404.ledr  =  3 'Not applicable  
	   	   	   	  var.whwmd404.ledt  =  3 'Not applicable  
	   	   	   	  var.whwmd404.lisf  =  3 'Not applicable  
	   	   	   	  var.whwmd404.lism  =  3 'Not applicable  
	   	   	  else  
	   	   	   	  'Lot controlled not in inventory  
	   	   	   	  var.whwmd404.lttr  =  1 'Yes  
	   	   	   	  var.whwmd404.linv  =  2 'No  
	   	   	   	  var.whwmd404.ledd  =  1 'Yes  
	   	   	   	  var.whwmd404.ledr  =  2 'No  
	   	   	   	  var.whwmd404.ledt  =  2 'No  
	   	   	   	  var.whwmd404.lisf  =  2 'No  
	   	   	   	  var.whwmd404.lism  =  2 'No  
	   	   	  end if  
	   	  else  
	   	   	  'Not lot controlled  
	   	   	  var.whwmd404.lttr  =  2 'No  
	   	   	  var.whwmd404.linv  =  2 'No  
	   	   	  var.whwmd404.ledd  =  3 'Not applicable  
	   	   	  var.whwmd404.ledr  =  3 'Not applicable  
	   	   	  var.whwmd404.ledt  =  3 'Not applicable  
	   	   	  var.whwmd404.lisf  =  3 'Not applicable  
	   	   	  var.whwmd404.lism  =  3 'Not applicable  
	   	  end if  
	   	   
	   	  If Items.SerialPrice  =  0 then  
	   	   	  'Use default value if not specified  
	   	   	  var.whwmd404.srpr  =  2 ' No  
	   	  Else  
	   	   	  var.whwmd404.srpr  =  Items.SerialPrice  	   
	   	  End if  
	   	  if Items.Serialized  =  1 then  
	   	   	  if Items.SerialsInInventory  =  1 then  
	   	   	   	  'Serialized and in inventory  
	   	   	   	  var.whwmd404.srtr  =  1 'Yes  
	   	   	   	  var.whwmd404.sinv  =  1 'Yes  
	   	   	   	  var.whwmd404.sedd  =  3 'Not applicable  
	   	   	   	  var.whwmd404.sedr  =  3 'Not applicable  
	   	   	   	  var.whwmd404.sedt  =  3 'Not applicable  
	   	   	   	  var.whwmd404.sisf  =  3 'Not applicable  
	   	   	   	  var.whwmd404.sism  =  3 'Not applicable  
	   	   	  else  
	   	   	   	  'Serialized not in inventory  
	   	   	   	  var.whwmd404.srtr  =  1 'Yes  
	   	   	   	  var.whwmd404.sinv  =  2 'No  
	   	   	   	  var.whwmd404.sedd  =  1 'Yes  
	   	   	   	  var.whwmd404.sedr  =  2 'No  
	   	   	   	  var.whwmd404.sedt  =  2 'No  
	   	   	   	  var.whwmd404.sisf  =  2 'No  
	   	   	   	  var.whwmd404.sism  =  2 'No  
	   	   	  end if  
	   	  else  
	   	   	  ' Not serialized  
	   	   	  var.whwmd404.srpr  =  2 'No  
	   	   	  var.whwmd404.srtr  =  2 'No  
	   	   	  var.whwmd404.sinv  =  2 'No  
	   	   	  var.whwmd404.sedd  =  3 'Not applicable  
	   	   	  var.whwmd404.sedr  =  3 'Not applicable  
	   	   	  var.whwmd404.sedt  =  3 'Not applicable  
	   	   	  var.whwmd404.sisf  =  3 'Not applicable  
	   	   	  var.whwmd404.sism  =  3 'Not applicable  
	   	  end if  	   	   
	   	  dump 007 '  |   *  whwmd404 Site  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:150
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsBySite
:ICOD:S
:QURY:START
select  	  ItemsBySite.*  , Items.*
from 	  ItemsBySite, Items
where 	  ItemsBySite.Project  =  Items.Project  
and  	  ItemsBySite.Item  =  Items.Item
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:150
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsBySite
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:401
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SerializedItems
:ICOD:D
:QURY:START
	  dump 401
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:401
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SerializedItems
:ICOD:S
:QURY:START
select SerializedItems.*
from SerializedItems
order by SerializedItems.Project, SerializedItems.Item, SerializedItems.SerialNumber
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:401
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SerializedItems
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:420
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesOrderLines
:ICOD:D
:QURY:START
	  if SalesOrderLines.ProductVariant  <>  "" then  
	  '  |  Fill Specifications  
	  '  |  Pre  -  requisite is that this product variant is present in tiapl300  
	   	  varstr.obj.ref  =  Cstr(SalesOrderLines.Line)  &  "/0"  
	   	  var.specification  =  "/M"  &  SalesOrderLines.OrderNumber  &  varstr.obj.ref  
	   	  dump 001 '  |   *  SalesOrderLines  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:420
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesOrderLines
:ICOD:S
:QURY:START
select  	  SalesOrderLines.*  , SalesOrderHeaders.*
from 	  SalesOrderLines, SalesOrderHeaders
where 	  SalesOrderHeaders.OrderNumber  =  SalesOrderLines.OrderNumber
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:ibd
:TFLNO:420
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesOrderLines
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:mcs
:TFLNO:143
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:D
:QURY:START
	  dump 1
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:mcs
:TFLNO:143
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:S
:QURY:START
select  	  Addresses.Country, Addresses.StateProvince
from 	  Addresses
where 	  Addresses.StateProvince  <>  ""
group by Addresses.Country, Addresses.StateProvince
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tc
:TCMOD:mcs
:TFLNO:143
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Addresses
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBPByItem
:ICOD:D
:QURY:START
	  var.tdipu010.scrp  =  ItemPurchaseBPByItem.SourcingPercentage  
	  if (var.tdipu010.scrp  =  "0") then  
	   	  var.tdipu010.scrp  =  100  
	  end if  
	   
	  var.tdipu010.efdt  =  get.utc(ItemPurchaseBPByItem.EffectiveDate,"yes")  
	  'var.tdipu010.exdt  =  get.utc(ItemPurchaseBPByItem.ExpDate,"yes")  
	  If ItemPurchaseBPByItem.ExpDate  =  "" or IsNull(ItemPurchaseBPByItem.ExpDate) then  	   
	   	  '  |   *  var.tdipu010.exdt  =  "1/19/2038"  	   	   	   	   	   	  '  |   #  LN10605.o  
	   	  var.tdipu010.exdt  =  get.max.date()  	   	   	   	   	   	   	  '  |   #  LN10605.n  
	  else  	   
	   	  var.tdipu010.exdt  =  get.utc(ItemPurchaseBPByItem.ExpDate,"yes")  
	  end if  
	  varstr.cprj  =  ItemPurchaseBPByItem.Project  
	  varstr.item  =  ItemPurchaseBPByItem.Item  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select  	  Items.*   
	   	  from  	   	  Items  
	   	  where  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  else  
	   	  select Items.*   
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj AND Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
'  |   	   	   	  var.qieq  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636o  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  	   	  '  |   #  .249636n  
	   	  endselect  
	  end if  
	  dump 1  	  '  |   #  tdipu010 by Item
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBPByItem
:ICOD:S
:QURY:START
select ItemPurchaseBPByItem.*
from ItemPurchaseBPByItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBPByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBPByItemGroup
:ICOD:D
:QURY:START
	  var.tdipu010.scrp  =  ItemPurchaseBPByItemGroup.SourcingPercentage  
	  if (var.tdipu010.scrp  =  "0") then  
	   	  var.tdipu010.scrp  =  100  
	  end if  
	   
	  var.tdipu010.efdt  =  get.utc(ItemPurchaseBPByItemGroup.EffectiveDate,"yes")  
	  If ItemPurchaseBPByItemGroup.ExpDate  =  "" or IsNull(ItemPurchaseBPByItemGroup.ExpDate) then  	   
	   	  var.tdipu010.exdt  =  get.max.date()  	   	   	   	   	   	   	   
	  else  	   
	   	  var.tdipu010.exdt  =  get.utc(ItemPurchaseBPByItemGroup.ExpDate,"yes")  
	  end if  
	  varstr.cprj  =  ItemPurchaseBPByItemGroup.Project  
	  varstr.item  =  ItemPurchaseBPByItemGroup.Item  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select  	  Items.*   
	   	  from  	   	  Items  
	   	  where  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  
	   	  endselect  
	  else  
	   	  select Items.*   
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj AND Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  var.qimf  =  Items.OrderQuantityIncrement  
	   	   	  var.qimi  =  Items.MinimumOrderQuantity  
	   	   	  var.qima  =  Items.MaximumOrderQuantity  
	   	   	  var.qifi  =  Items.FixedOrderQuantity  
	   	   	  var.qiec  =  Items.EconomicOrderQuantity  
	   	  endselect  
	  end if  
	  dump 2  	  '  |   #  tdipu010 by ItemGroup
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBPByItemGroup
:ICOD:S
:QURY:START
select ItemPurchaseBPByItemGroup.*
from ItemPurchaseBPByItemGroup
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:ipu
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemPurchaseBPByItemGroup
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBPByItem
:ICOD:D
:QURY:START
	  var.tdisa010.efdt  =  get.utc(ItemSalesBPByItem.EffectiveDate,"Yes")  
	  If ItemSalesBPByItem.ExpDate  =  "" or IsNull(ItemSalesBPByItem.ExpDate) then  	   
	   	  var.tdisa010.exdt  =  get.max.date()  
	  else  	   
	   	  var.tdisa010.exdt  =  get.utc(ItemSalesBPByItem.ExpDate,"Yes")  
	  end if  
	  dump 1  	  '  |   #  tdisa001 by Item
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBPByItem
:ICOD:S
:QURY:START
select ItemSalesBPByItem.*
from ItemSalesBPByItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBPByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBPByItemGroup
:ICOD:D
:QURY:START
	  var.tdisa010.efdt  =  get.utc(ItemSalesBPByItemGroup.EffectiveDate,"Yes")  
	  If ItemSalesBPByItemGroup.ExpDate  =  "" or IsNull(ItemSalesBPByItemGroup.ExpDate) then  	   
	   	  var.tdisa010.exdt  =  get.max.date()  
	  else  	   
	   	  var.tdisa010.exdt  =  get.utc(ItemSalesBPByItemGroup.ExpDate,"Yes")  
	  end if  
	  dump 2  	  '  |   #  tdisa001 by ItemGroup
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBPByItemGroup
:ICOD:S
:QURY:START
select ItemSalesBPByItemGroup.*
from ItemSalesBPByItemGroup
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:isa
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSalesBPByItemGroup
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:D
:QURY:START
	   	   	   	   	   	   	   	   	   	  '  |   *  LN10605.sn'  
	  var.tdpcg031.prty  =  5  
	  varstr.book  =  PriceBooks.PriceBook  
	  select PriceBookCodes.*   
	  from PriceBookCodes  
	  where PriceBookCodes.PriceBook  =  varstr.book  
	  selectdo  
	   	  if PriceBookCodes.Module  =  1 then  
	   	   	  var.tdpcg031.prty  =  5  
	   	  else  
	   	   	  var.tdpcg031.prty  =  10  
	   	  end if  
	  endselect  	   
	   	   	   	   	   	   	   	   	   	  '  |   *  LN10605.en'  
	  var.tdpcg031.efdt  =  get.utc(PriceBooks.EffectiveDate,"yes")  
	  var.tdpcg031.exdt  =  get.utc(PriceBooks.ExpiryDate,"no")  
	  var.tdpcg031.endt  =  get.utc(PriceBooks.EntryDate,"yes")  
	   
	  dump 031 '  |  tdpcg031'
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:S
:QURY:START
select PriceBooks.*
from PriceBooks
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pcg
:TFLNO:031
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PriceBooks
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pur
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PurchaseContracts
:ICOD:D
:QURY:START
	  var.tdpur300.cdat  =  get.utc(PurchaseContracts.ContractDate,"no")  
	  var.tdpur300.sdat  =  get.utc(PurchaseContracts.EffectiveDate,"no")  
	  var.tdpur300.edat  =  get.utc(PurchaseContracts.ExpiryDate,"no")  
	  dump 300
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pur
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PurchaseContracts
:ICOD:S
:QURY:START
select  	  PurchaseContracts.*
from 	  PurchaseContracts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pur
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PurchaseContracts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pur
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PurchaseContractLines
:ICOD:D
:QURY:START
	  if PurchaseContractLines.PurchaseOffice  =  "" then  
	   	  var.tdpur301.cofc  =  PurchaseContracts.PurchaseOffice  
	  else  
	   	  var.tdpur301.cofc  =  PurchaseContractLines.PurchaseOffice  
	  end if  
	  var.tdpur301.cdat  =  get.utc(PurchaseContracts.ContractDate,"yes")  
	  var.tdpur301.sdat  =  get.utc(PurchaseContracts.EffectiveDate,"no")  
	  var.tdpur301.edat  =  get.utc(PurchaseContracts.ExpiryDate,"no")  
	  dump 301  
	  dump 303
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pur
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PurchaseContractLines
:ICOD:S
:QURY:START
select  	  PurchaseContractLines.*  , PurchaseContracts.*
from 	  PurchaseContractLines, PurchaseContracts
where 	  PurchaseContractLines.Contract  =  PurchaseContracts.contract
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pur
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PurchaseContractLines
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pur
:TFLNO:400
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PurchaseOrderHeaders
:ICOD:D
:QURY:START
	  var.tdpur400.odat  =  get.utc(PurchaseOrderHeaders.OrderDate, "yes")  
	  var.tdpur400.ddat  =  get.utc(PurchaseOrderHeaders.ReceiptDate, "yes")  
	  var.tdpur400.cdf_ccdt  =  get.utc(PurchaseOrderHeaders.ConfirmedDeliveryDate, "no")  
	  dump 001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pur
:TFLNO:400
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PurchaseOrderHeaders
:ICOD:S
:QURY:START
select PurchaseOrderHeaders.*
from PurchaseOrderHeaders
order by PurchaseOrderHeaders.OrderNumber
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pur
:TFLNO:400
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PurchaseOrderHeaders
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pur
:TFLNO:401
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PurchaseOrderLines
:ICOD:D
:QURY:START
	  var.tdpur401.odat  =  get.utc(PurchaseOrderHeaders.OrderDate, "yes")  
	  var.tdpur401.cdf_scdd  =  get.utc(PurchaseOrderLines.ConfDeliveryDate, "no")  
	  If PurchaseOrderLines.PlannedReceiptDate  =  "" or IsNull(PurchaseOrderLines.PlannedReceiptDate) then  	   
	   	  var.tdpur401.ddta  =  get.utc(PurchaseOrderHeaders.ReceiptDate, "no")  
	  else  	   
	   	  var.tdpur401.ddta  =  get.utc(PurchaseOrderLines.PlannedReceiptDate, "no")  
	  end if  
	  if PurchaseOrderLines.LineDiscount  >  0.0 or _  
	  PurchaseOrderLines.DiscountAmount  >  0.0 then  
	   	  var.tdpur401.dorg  =  4  
	  else  
	   	  var.tdpur401.dorg  =  2  
	  end if  
	  dump 001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pur
:TFLNO:401
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PurchaseOrderLines
:ICOD:S
:QURY:START
select PurchaseOrderLines.*  , PurchaseOrderHeaders.*
from PurchaseOrderLines, PurchaseOrderHeaders
where PurchaseOrderHeaders.OrderNumber  =  PurchaseOrderLines.OrderNumber
order by PurchaseOrderLines.OrderNumber, PurchaseOrderLines.Line
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:pur
:TFLNO:401
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PurchaseOrderLines
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:sls
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesContracts
:ICOD:D
:QURY:START
	  var.tdsls300.cdat  =  get.utc(SalesContracts.ContractDate,"no")  
	  var.tdsls300.sdat  =  get.utc(SalesContracts.EffectiveDate,"no")  
	  var.tdsls300.edat  =  get.utc(SalesContracts.ExpiryDate,"no")  
	  dump 300
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:sls
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesContracts
:ICOD:S
:QURY:START
select SalesContracts.*
from SalesContracts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:sls
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesContracts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:sls
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesContractLines
:ICOD:D
:QURY:START
	  var.tdsls301.cdat  =  get.utc(SalesContracts.ContractDate,"yes")  
	  var.tdsls301.sdat  =  get.utc(SalesContracts.EffectiveDate,"no")  
	  var.tdsls301.edat  =  get.utc(SalesContracts.ExpiryDate,"no")  
	  dump 301
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:sls
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesContractLines
:ICOD:S
:QURY:START
select SalesContractLines.*  , SalesContracts.*
from SalesContractLines, SalesContracts
where SalesContractLines.Contract  =  SalesContracts.contract
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:sls
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesContractLines
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:sls
:TFLNO:400
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesOrderHeaders
:ICOD:D
:QURY:START
	  var.tdsls400.odat  =  get.utc(SalesOrderHeaders.OrderDate,"yes")  
	  var.tdsls400.ddat  =  get.utc(SalesOrderHeaders.PlannedDelDate,"yes")  
	  var.tdsls400.prdt  =  get.utc(SalesOrderHeaders.PlannedReceiptDate,"no")  
	  dump 001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:sls
:TFLNO:400
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesOrderHeaders
:ICOD:S
:QURY:START
select SalesOrderHeaders.*
from SalesOrderHeaders
order by SalesOrderHeaders.OrderNumber
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:sls
:TFLNO:400
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesOrderHeaders
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:sls
:TFLNO:401
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesOrderLines
:ICOD:D
:QURY:START
	  var.tdsls401.odat  =  get.utc(SalesOrderHeaders.OrderDate,"yes")  
	  var.tdsls401.prdt  =  get.utc(SalesOrderLines.PlannedReceiptDate,"no")  
	  if Not IsNull(SalesOrderLines.PlannedDelDate) then  
	   	  var.tdsls401.ddta  =  get.utc(SalesOrderLines.PlannedDelDate,"yes")  
	  else  
	   	  var.tdsls401.ddta  =  get.utc(SalesOrderHeaders.PlannedDelDate,"yes")  
	  end if  
	  if Trim(SalesOrderLines.ShipToBP)  <>  "" then  
	   	  var.tdsls401.stbp  =  SalesOrderLines.ShipToBP  
	  else  
	   	  var.tdsls401.stbp  =  SalesOrderHeaders.SoldToBP  
	  end if  
	  if SalesOrderLines.LineDiscount  >  0.0 then  
	   	  var.tdsls401.dorg  =  4  
	  else  
	   	  var.tdsls401.dorg  =  2  
	  end if  
	  if SalesOrderLines.Lot  <>  "" then  
	   	  var.tdsls401.lsel  =  3  
	  else  
	   	  var.tdsls401.lsel  =  1  
	  end if  
	  if SalesOrderLines.SerialNumber  <>  "" then  
	   	  var.tdsls401.ssel  =  2  
	  else  
	   	  var.tdsls401.ssel  =  1  
	  end if  
	  dump 001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:sls
:TFLNO:401
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesOrderLines
:ICOD:S
:QURY:START
select SalesOrderLines.*  , SalesOrderHeaders.*
from SalesOrderLines, SalesOrderHeaders
where SalesOrderHeaders.OrderNumber  =  SalesOrderLines.OrderNumber
order by SalesOrderLines.OrderNumber, SalesOrderLines.Line
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:td
:TCMOD:sls
:TFLNO:401
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SalesOrderLines
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:acr
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpenEntriesAccountsReceivable
:ICOD:D
:QURY:START
	  var.tfacr200.ratd  =  get.utc(OpenEntriesAccountsReceivable.DocumentDate,"yes")  
	  if OpenEntriesAccountsReceivable.TotalAmount  >  0.0 then  
	   	  var.tfacr200.trec  =  1  	  '  *  sales invoice  
	  else  
	   	  var.tfacr200.trec  =  4  	  '  *  credit note  
	  end if  
	  dump 200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:acr
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpenEntriesAccountsReceivable
:ICOD:S
:QURY:START
select  	  OpenEntriesAccountsReceivable.*
from 	  OpenEntriesAccountsReceivable
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:acr
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpenEntriesAccountsReceivable
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:fam
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Assets
:ICOD:D
:QURY:START
	  if Assets.AssetDistrBy  =  "0" then  
	   	  var.dbfg  =  1  
	  else  
	   	  var.dbfg  =  Assets.AssetDistrBy  
	  end if  
	  if Assets.Listed  =  "0" then  
	   	  var.list  =  2  
	  else  
	   	  var.list  =  Assets.Listed  
	  end if  
	  if Assets.New  =  "0" then  
	   	  var.newu  =  1  
	  else  
	   	  var.newu  =  Assets.New  
	  end if  
	  if Assets.Owner  =  "0" then  
	   	  var.ownc  =  1  
	  else  
	   	  var.ownc  =  Assets.Owner  
	  end if  
	  if len(trim(Assets.Description))  >  0 then  
	   	  varstr.dsca  =  Assets.Description  	   	   
	  else  
	   	  varstr.dsca  =  Assets.AssetNumber  &  ", "  &  Assets.AssetExtension  
	  end if  
	   
	  var.tffam100.ratd  =  get.utc(Assets.RateDate,"yes")  
	  var.tffam100.acmd  =  get.date(Assets.LastMaintDate,"no")  
	  var.tffam100.pudt  =  get.date(Assets.PurchaseDate,"yes")  
	  var.tffam100.srvc  =  get.date(Assets.ServiceDate,"yes")  
	  dump 100 '  |  tffam100
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:fam
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Assets
:ICOD:S
:QURY:START
select Assets.*
from Assets
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:fam
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Assets
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:D
:QURY:START
	  If Trim(varstr.SourceGLVersion)  =  "Other" then  
	  '  |  Migrate non  -  InforFMS data  
	   	  if ChartOfAccounts.Dimension1Used  =  "0" then  
	   	   	  var.dim1  =  2 '  |  Optional  
	   	  else  
	   	   	  var.dim1  =  ChartOfAccounts.Dimension1Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension2Used  =  "0" then  
	   	   	  var.dim2  =  2  
	   	  else  
	   	   	  var.dim2  =  ChartOfAccounts.Dimension2Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension3Used  =  "0" then  
	   	   	  var.dim3  =  2  
	   	  else  
	   	   	  var.dim3  =  ChartOfAccounts.Dimension3Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension4Used  =  "0" then  
	   	   	  var.dim4  =  2  
	   	  else  
	   	   	  var.dim4  =  ChartOfAccounts.Dimension4Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension5Used  =  "0" then  
	   	   	  var.dim5  =  2  
	   	  else  
	   	   	  var.dim5  =  ChartOfAccounts.Dimension5Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension6Used  =  "0" then  
	   	   	  var.dim6  =  2  
	   	  else  
	   	   	  var.dim6  =  ChartOfAccounts.Dimension6Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension7Used  =  "0" then  
	   	   	  var.dim7  =  2  
	   	  else  
	   	   	  var.dim7  =  ChartOfAccounts.Dimension7Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension8Used  =  "0" then  
	   	   	  var.dim8  =  2  
	   	  else  
	   	   	  var.dim8  =  ChartOfAccounts.Dimension8Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension9Used  =  "0" then  
	   	   	  var.dim9  =  2  
	   	  else  
	   	   	  var.dim9  =  ChartOfAccounts.Dimension9Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension10Used  =  "0" then  
	   	   	  var.dim10  =  2  
	   	  else  
	   	   	  var.dim10  =  ChartOfAccounts.Dimension10Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension11Used  =  "0" then  
	   	   	  var.dim11  =  2  
	   	  else  
	   	   	  var.dim11  =  ChartOfAccounts.Dimension11Used  
	   	  end if  
	   	  if ChartOfAccounts.Dimension12Used  =  "0" then  
	   	   	  var.dim12  =  2  
	   	  else  
	   	   	  var.dim12  =  ChartOfAccounts.Dimension12Used  
	   	  end if  
	   	  if ChartOfAccounts.DualAccountingIndicator  =  "0" then  
	   	   	  var.duac  =  1  
	   	  else  
	   	   	  var.duac  =  ChartOfAccounts.DualAccountingIndicator  
	   	  end if  
	   	  if ChartOfAccounts.FixedAssetIntegration  =  "0" then  
	   	   	  var.ifas  =  4  
	   	  else  
	   	   	  var.ifas  =  ChartOfAccounts.FixedAssetIntegration  
	   	  end if  
	   	  if ChartOfAccounts.IntegrationAccount  =  "0" then  
	   	   	  var.inta  =  2  
	   	  else  
	   	   	  var.inta  =  ChartOfAccounts.IntegrationAccount  
	   	  end if  
	   	  if ChartOfAccounts.IntegrationIndicator  =  "0" then  
	   	   	  var.iprj  =  7  
	   	  else  
	   	   	  var.iprj  =  ChartOfAccounts.IntegrationIndicator  
	   	  end if  
	   	  if ChartOfAccounts.BlockingStatus  =  "0" or Trim(ChartOfAccounts.BlockingStatus)  =  "" then  
	   	   	  var.bloc  =  1  
	   	  else  
	   	   	  var.bloc  =  ChartOfAccounts.BlockingStatus  
	   	  end if  
	   	  if var.bloc  =  1 then  
	   	   	  var.bfdt  =  get.date("","no")  
	   	   	  var.budt  =  get.date("","no")  
	   	  else  
	   	   	  var.bfdt  =  get.date(ChartOfAccounts.BlockingEffectiveFrom,"no")  
	   	   	  var.budt  =  get.date(ChartOfAccounts.BlockingEffectiveTo,"no")  
	   	  end if  
	   	  dump 008 '  |  Other GL Source version  
	  else  
	  '  |  Migrate InforFMS data  
	   	  '  |  Mapping of AccountType to D  /  C Indicator  
	   	  acc.type  =  ChartOfAccounts.AccountTypeInforFMS  
	   	  if trim(acc.type)  <>  "" then  
	   	   	  varstr.OpenDate  =  ChartOfAccounts.OpenDateInforFMS  
	   	   	  varstr.ClosedDate  =  ChartOfAccounts.ClosedDateInforFMS  
	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Closed" then  
	   	   	   	  if varstr.OpenDate  =  "" then  
	   	   	   	   	  varstr.OpenDate  =  date()  
	   	   	   	  end if  
	   	   	   	  if varstr.ClosedDate  =  "" then  	   	   	   
	   	   	   	   	  varstr.ClosedDate  =  CDate("12/31/2038")  
	   	   	   	  end if  
	   	   	  end if  
	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Open" then  
	   	   	   	  varstr.OpenDate  =  ""  
	   	   	   	  varstr.ClosedDate  =  ""  
	   	   	  end if  
	   	   	  If acc.type  =  "A" or acc.type  =  "E" or acc.type  =  "V" or acc.type  =  "B" then  
	   	   	   	  varint.DebitCreditIndicator  =  1 '  |  tfgld.dbcr.debit '  |  1 '  |  Debit  
	   	   	  End If  	   
	   	   	  If acc.type  =  "L" or acc.type  =  "I" then  
	   	   	   	  varint.DebitCreditIndicator  =  2 '  |  tfgld.dbcr.credit '  |  2 '  |  Credit  	   
	   	   	  End If  	   
	   	   	  '  |  Mentioning the Account Type  
	   	   	  If acc.type  =  "A" or acc.type  =  "L" or acc.type  =  "B" then  
	   	   	   	  varint.AccountType  =  1 '  |  Balance Sheet  
	   	   	  End If  
	   	   	  if acc.type  =  "E" or acc.type  =  "V" or acc.type  =  "I" then  
	   	   	   	  varint.AccountType  =  2 '  |  Profit  &  Loss  
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GL2" then  
	   	   	   	  '  |  Determining the Status for the Blocking field  
	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free '  |  1  
	   	   	   	  '  |  Currency Analysis  
	   	   	   	  var.icur  =  1 '  |  tcicur.not.required '  |  1  
	   	   	   	  '  |  For Sublevel  
	   	   	   	  var.sublevel  =  0 '  |  ChartOfAccounts.Sublevel '  |  default()  
	   	   
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GL3" then  
	   	   	   	  '  |  Determining the Status for the Blocking field  
	   	   	   	  if ChartOfAccounts.StatusInforFMS  =  "Open" then  
	   	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free '  |  1  
	   	   	   	  else  	   	   
	   	   	   	   	  var.status  =  3 '  |  tfgld.bloc.all.input '  |  3  
	   	   	   	  end if  
	   	   	   	  '  |  Currency Analysis  
	   	   	   	  var.icur  =  2 '  |  tcicur.required '  |  2  
	   	   	   	  '  |  For Sublevel  
	   	   	   	  var.sublevel  =  0 '  |  ChartOfAccounts.Sublevel '  |  default()  
	   
	   	   	  end if  
	   	   	  if Trim(varstr.SourceGLVersion)  =  "GLE" then  
	   	   	   	  if acc.type  =  "1" or acc.type  =  "5" or acc.type  =  "6" or acc.type  =  "8" then  
	   	   	   	   	  varint.DebitCreditIndicator  =  1 '  |  tfgld.dbcr.debit  
	   	   	   	  end if  	   
	   	   	   	  if acc.type  =  "2" or acc.type  =  "3" or acc.type  =  "4" or acc.type  =  "7" then  
	   	   	   	   	  varint.DebitCreditIndicator  =  2 '  |  tfgld.dbcr.credit  
	   	   	   	  end if  	   
	   	   	   	  '  |  Mentioning the Account Type  
	   	   	   	  if acc.type  =  "1" or acc.type  =  "2" or acc.type  =  "3" then  
	   	   	   	   	  varint.AccountType  =  1 '  |  Balance Sheet  
	   	   	   	  else  
	   	   	   	   	  varint.AccountType  =  2 '  |  Profit  &  Loss  
	   	   	   	  end if  	   
	   	   	   	  '  |  Currency Analysis  	   
	   	   	   	  var.icur  =  1 '  |  tcicur.not.required  
	   	   	   	  '  |  Status of Blocking field  
	   	   	   	  var.status  =  1 '  |  tfgld.bloc.free  
	   	   	   	  '  |  Calculating Sublevel  
	   	   	   	  var.sublevel  =  ChartOfAccounts.LedgerAccountSublevel  
	   
	   	   	  end if  
	   	   	  dump 009 '  |  Chart Of Accounts InforFMS  
	   	  end if  
	  End If
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:S
:QURY:START
select ChartOfAccounts.*
from ChartOfAccounts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:008
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ChartOfAccounts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:D
:QURY:START
	  dump 011
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:S
:QURY:START
select TransactionTypes.*
from TransactionTypes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:011
:SCPAC:bc
:SCMOD:tbl
:SFLNO:TransactionTypes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpenEntriesAccountsPayable
:ICOD:D
:QURY:START
	  dump 2 '  |  AP
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpenEntriesAccountsPayable
:ICOD:S
:QURY:START
select  	  OpenEntriesAccountsPayable.TransactionType
from 	  OpenEntriesAccountsPayable
group by OpenEntriesAccountsPayable.TransactionType
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpenEntriesAccountsPayable
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpenEntriesAccountsReceivable
:ICOD:D
:QURY:START
	  dump 3 '  |  Opening Balances
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpenEntriesAccountsReceivable
:ICOD:S
:QURY:START
select  	  OpeningBalances.TransactionType
from 	  OpeningBalances
group by OpeningBalances.TransactionType
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpenEntriesAccountsReceivable
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpeningBalances
:ICOD:D
:QURY:START
	  dump 1 '  |  AR
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpeningBalances
:ICOD:S
:QURY:START
select  	  OpenEntriesAccountsReceivable.TransactionType
from 	  OpenEntriesAccountsReceivable
group by OpenEntriesAccountsReceivable.TransactionType
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpeningBalances
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpenEntriesAccountsReceivable
:ICOD:D
:QURY:START
	  if OpenEntriesAccountsReceivable.TotalAmount  >  0.0 then  
	   	  var.tfgld102.catg  =  3  	  '  *  sales invoice  
	   	  var.tfgld102.dbcr  =  2  
	  else  
	   	  var.tfgld102.catg  =  4  	  '  *  credit note  
	   	  var.tfgld102.dbcr  =  1  
	  end if  
	  dump 1 '  |  ACR Line
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpenEntriesAccountsReceivable
:ICOD:S
:QURY:START
select  	  OpenEntriesAccountsReceivable.*
from 	  OpenEntriesAccountsReceivable
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpenEntriesAccountsReceivable
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpeningBalances
:ICOD:D
:QURY:START
	  var.tfgld102.dcdt  =  get.utc(OpeningBalances.DocumentDate, "yes")  
	  dump 2 '  |  Opening Balance Line
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpeningBalances
:ICOD:S
:QURY:START
select  	  OpeningBalances.*
from 	  OpeningBalances
order by OpeningBalances.TransactionType, OpeningBalances.AccountingScheme, OpeningBalances.LedgerAccount
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpeningBalances
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:D
:QURY:START
	  If varstr.source.gl.version  =  "GL2" or varstr.source.gl.version  =  "GL3" then  
	  '  |  Migrate data for InforFMS 'M  -  Series'  
	   	  If GLTransactions.CurrencySource  =  empty then  
	   	   	  varstr.currency  =  GeneralParameters.BookingCurrency1  
	   	  Else  
	   	   	  varstr.currency  =  GLTransactions.CurrencySource  
	   	  End If  
	   	   
	   	  var.rate1  =  get.rate(GLTransactions.Rate1, var.RateFactor1)  
	   	  var.rate2  =  get.rate(GLTransactions.Rate2, var.RateFactor2)  
	   	  If GLTransactions.RateDate  =  empty then  
	   	   	  var.RateDate  =  GLTransactions.EffectiveDateInforFMS  
	   	  Else  
	   	   	  var.RateDate  =  GLTransactions.RateDate  
	   	  End If  
	   	  if trim(var.rate1)  =  "" then  	   
	   	   	  var.rate1  =  "1.000000"  
	   	  end if  
	   	  if trim(var.rate2)  =  "" then  	   
	   	   	  var.rate2  =  "0.000001"  
	   	  end if  
	   	  If GLTransactions.RateTypeSource  =  empty then  
	   	   	  varstr.RateType  =  GeneralParameters.ExchangeRateType  
	   	  Else  
	   	   	  varstr.RateType  =  GLTransactions.RateTypeSource  
	   	  End If  
	   	  If varstr.source.gl.version  =  "GL2" then  
	   	   	  var.GLTransaction.BookingAmount2  =  GLTransactions.BookingAmount2  
	   	  Else  
	   	   	  var.GLTransaction.BookingAmount2  =  0  
	   	  End If  
	   	  If GLTransactions.EffectiveDateInforFMS  <>  varstr.PrevEffectiveDate then  
	   	   	  var.tfgld106.olin  =  1  	   
	   	   	  If varstr.source.gl.version  =  "GL2" then  	   
	   	   	   	  var.DocumentID  =  var.DocumentID  +  1  
	   	   	   	  dump 018 '  |  Documents InforFMS GL2  /  GL3  
	   	   	  End If  
	   	  Else  
	   	   	  var.tfgld106.olin  =  var.tfgld106.olin  +  1  
	   	  End if  
	   	  varstr.PrevEffectiveDate  =  GLTransactions.EffectiveDateInforFMS  
	  End If  
	  varstr.dim2  =  Mid (GLTransactions.Reference1 , 22 , 1 )  
	  varstr.dim3  =  Mid (GLTransactions.Reference1 , 24 , 9 )  
	  dump 106 '  |  Finalized Transactions InforFMS GL2  /  GL3  
	  If varstr.source.gl.version  =  "GLE" then  
	  '  |  Migrate data for InforFMS 'E  -  Series'  
	   	  select  	  GLTransactions.*   
	   	  from  	  GLTransactions  
	   	  order by GLTransactions.FiscalYear, GLTransactions.Period Asc  
	   	  selectdo  
	   	   	  If GLTransactions.CurrencySource  =  empty then  
	   	   	   	  varstr.currency  =  GeneralParameters.BookingCurrency1  
	   	   	  Else  
	   	   	   	  varstr.currency  =  GLTransactions.CurrencySource  
	   	   	  End If  
	   	   	  var.rate1  =  get.rate(GLTransactions.Rate1, var.RateFactor1)  
	   	   	  var.rate2  =  get.rate(GLTransactions.Rate2, var.RateFactor2)  
	   	   	  If GLTransactions.RateDate  =  empty then  
	   	   	   	  var.RateDate  =  GLTransactions.EffectiveDate  
	   	   	  Else  
	   	   	   	  var.RateDate  =  GLTransactions.RateDate  
	   	   	  End If  
	   	   	  If GLTransactions.RateTypeSource  =  empty then  
	   	   	   	  varstr.RateType  =  GeneralParameters.ExchangeRateType  
	   	   	  Else  
	   	   	   	  varstr.RateType  =  GLTransactions.RateTypeSource  
	   	   	  End If  
	   	   	  If GLTransactions.FiscalYear  <>  varint.PrevFiscalYear Or GLTransactions.Period  <>  varint.PrevPeriod then  
	   	   	   	  var.DocumentID  =  var.DocumentID  +  1  
	   	   	   	  dump 918 '  |  Documents InforFMS GLE  
	   	  End If  
	   	  varint.PrevFiscalYear  =  GLTransactions.FiscalYear  
	   	  varint.PrevPeriod  =  GLTransactions.Period  
	   	  dump 906 '  |  Finalized Transactions InforFMS GLE  
	  endselect  
End If  
If varstr.source.gl.version  =  "Other" then  
'  |  Migrate data for other source systems  
End If
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:S
:QURY:START
select  	  GLTransactions.*
from 	  GLTransactions  
'  |  order by GLTransactions.EffectiveDateInforFMS Asc
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GLTransactions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpeningBalances
:ICOD:D
:QURY:START
	  if varstr.ttyp  <>  OpeningBalances.TransactionType or _  
	  varlng.document  <>  OpeningBalances.Document then  
	   	  var.tfgld018.dcdt  =  get.date(OpeningBalances.DocumentDate, "no")  
	   	  dump 818 '  |  tfgld018 from OpeningBalances  
	  end if  
	  varstr.ttyp  =  OpeningBalances.TransactionType  
	  varlng.document  =  OpeningBalances.Document
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpeningBalances
:ICOD:S
:QURY:START
select  	  OpeningBalances.*
from 	  OpeningBalances
order by OpeningBalances.TransactionType, OpeningBalances.Document
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tf
:TCMOD:gld
:TFLNO:106
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OpeningBalances
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyOperations
:ICOD:D
:QURY:START
	  dump 100
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyOperations
:ICOD:S
:QURY:START
select AssemblyOperations.*
from AssemblyOperations
order by AssemblyOperations.Operation
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyOperations
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyOperationsAssignments
:ICOD:D
:QURY:START
	  var.tiapl110.exdt  =  "1/19/2038"  
	  dump 110
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyOperationsAssignments
:ICOD:S
:QURY:START
select AssemblyOperationsAssignments.*
from AssemblyOperationsAssignments
order by AssemblyOperationsAssignments.Operation, AssemblyOperationsAssignments.LineStation
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyOperationsAssignments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:120
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyOperationsInspectionProtocol
:ICOD:D
:QURY:START
	  dump 120
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:120
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyOperationsInspectionProtocol
:ICOD:S
:QURY:START
select AssemblyOperationsInspectionProtocol.*
from AssemblyOperationsInspectionProtocol
order by AssemblyOperationsInspectionProtocol.Operation, AssemblyOperationsInspectionProtocol.LineStation,  
	  AssemblyOperationsInspectionProtocol.Item, AssemblyOperationsInspectionProtocol.ProcessVariable
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:120
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyOperationsInspectionProtocol
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyBOMandOperations
:ICOD:D
:QURY:START
	  var.tiapl210.efdt  =  get.utc(AssemblyBOMandOperations.EffectiveDate, "yes")  
	  var.tiapl210.exdt  =  "1/19/2038"  
	  dump 210
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyBOMandOperations
:ICOD:S
:QURY:START
select AssemblyBOMandOperations.*
from AssemblyBOMandOperations
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyBOMandOperations
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyBOMandOperations
:ICOD:D
:QURY:START
	  var.tiapl220.efdt  =  get.utc(AssemblyBOMandOperations.EffectiveDate,"yes")  
	  var.tiapl220.exdt  =  "1/19/2038"  
	  if AssemblyBOMandOperations.LabelsRequired  =  "Y" or AssemblyBOMandOperations.LabelsRequired  =  "y" then  
	   	  var.tiapl220.cdf_lreq  =  1  
	  else  
	   	  var.tiapl220.cdf_lreq  =  2  
	  end if  
	  dump 220
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyBOMandOperations
:ICOD:S
:QURY:START
select AssemblyBOMandOperations.*
from AssemblyBOMandOperations
order by AssemblyBOMandOperations.ItemEngineeringModule, AssemblyBOMandOperations.Position
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyBOMandOperations
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductVariantsAssembly
:ICOD:D
:QURY:START
	  var.tiapl300.pcfd  =  get.utc(ProductVariantsAssembly.ProductConfigurationDate,"yes")  
	  var.tiapl300.cdf_efdt  =  get.utc(ProductVariantsAssembly.EffectiveFromDate,"no")  
	  var.tiapl300.cdf_epry  =  get.utc(ProductVariantsAssembly.ExpiryOnDate,"no")  
	  dump 300  
	  dump 500  
	  dump 510
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductVariantsAssembly
:ICOD:S
:QURY:START
select  	  ProductVariantsAssembly.*
from 	  ProductVariantsAssembly
order by ProductVariantsAssembly.ProductVariant
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:apl
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductVariantsAssembly
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:asl
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyLines
:ICOD:D
:QURY:START
	  dump 130
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:asl
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyLines
:ICOD:S
:QURY:START
select AssemblyLines.*
from AssemblyLines
order by AssemblyLines.AssemblyLine
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:asl
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AssemblyLines
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:asl
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LineSegments
:ICOD:D
:QURY:START
	  dump 140
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:asl
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LineSegments
:ICOD:S
:QURY:START
select LineSegments.*
from LineSegments
order by LineSegments.LineSegment
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:asl
:TFLNO:140
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LineSegments
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:asl
:TFLNO:141
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LineSegmentsByAssemblyLine
:ICOD:D
:QURY:START
	  dump 141
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:asl
:TFLNO:141
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LineSegmentsByAssemblyLine
:ICOD:S
:QURY:START
select  	  LineSegmentsByAssemblyLine.*
from 	  LineSegmentsByAssemblyLine
order by LineSegmentsByAssemblyLine.AssemblyLine, LineSegmentsByAssemblyLine.LineSegment, LineSegmentsByAssemblyLine.NextLineSegment
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:asl
:TFLNO:141
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LineSegmentsByAssemblyLine
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:asl
:TFLNO:150
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StationsByLineSegment
:ICOD:D
:QURY:START
	  varstr.station  =  StationsByLineSegment.Station  
	  select Stations.*   
	  from  	  Stations  
	  where  	  Stations.Station  =  varstr.station  
	  selectdo  
	  endselect  
	  var.tisl150.kowc  =  Stations.StationType  
	  var.tiasl150.efdt  =  get.utc(StationsByLineSegment.EffectiveDate, "yes")  
	  If StationsByLineSegment.ExpiryDate  =  "" or IsNull(StationsByLineSegment.ExpiryDate) then  
	   	  var.tiasl150.exdt  =  "1/19/2038"  
	  else  
	   	  var.tiasl150.exdt  =  get.utc(StationsByLineSegment.ExpiryDate, "no")  
	  End If  
	  dump 150
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:asl
:TFLNO:150
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StationsByLineSegment
:ICOD:S
:QURY:START
select StationsByLineSegment.*
from StationsByLineSegment
order by StationsByLineSegment.LineSegment, StationsByLineSegment.Station, StationsByLineSegment.NextStation, StationsByLineSegment.EffectiveDate
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:asl
:TFLNO:150
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StationsByLineSegment
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cpr
:TFLNO:007
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsCosting
:ICOD:D
:QURY:START
	  DefaultFound  =  0  	   	   	  '  |   #  Default found is false  
	  if def.cst then  
	   	  varint.itemtype  =  Items.ItemType  
	   	  varstr.itemgroup  =  Items.ItemGroup  
	   	  varstr.entunit  =  ItemsCosting.EnterpriseUnit  
	   	  select ItemDefaultsCosting.*   
	   	  from  	  ItemDefaultsCosting  
	   	  where  	  ItemDefaultsCosting.kitm  =  varint.itemtype  
	   	  and  	  ItemDefaultsCosting.citg  =  varstr.itemgroup  
	   	  and  	  ItemDefaultsCosting.eunt  =  varstr.entunit  
	   	  selectdo  
	   	   	  DefaultFound  =  1  	   	  '  |   #  Default found is true  
	   	  endselect  
	  end if  	   	   	   
	  if ItemsCosting.CostingType  =  30 then  
	   	  var.ticpr007.base  =  target(tcyesno.no)  
	   	  var.tipcr007.scos  =  target(ticpr.srce.not.applicable)  
	  else  
	   	  var.ticpr007.base  =  target(tcyesno.yes)  
	   	  var.tipcr007.scos  =  ItemsCosting.CostingSource  
	  end if  
	  if ItemsCosting.CostingSource  =  55 then  
	   	  var.ticpr007.cofc  =  ItemsCosting.SupplyingPO  
	  else  
	   	  var.ticpr007.cofc  =  ""  
	  end if  
	  if ItemsCosting.CostingSource  =  50 then  
	   	  var.ticpr007.sueu  =  ItemsCosting.SupplyingEU  
	  else  
	   	  var.ticpr007.sueu  =  ""  
	  end if  
	  var.ticpr007.ccur  =  ItemHandling.GetTypeString(ItemDefaultsCosting.ccur, ItemsCosting.CostingCurrency, Items.Exception, DefaultFound)  
	  var.ticpr007.chrt  =  ItemHandling.GetTypeString(ItemDefaultsCosting.chrt, ItemsCosting.Chart, Items.Exception, DefaultFound)  
	  var.ticpr007.lcst  =  ItemHandling.GetTypeString(ItemDefaultsCosting.lcst, "", Items.Exception, DefaultFound)  
	  var.ticpr007.inlc  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.inlc, ItemsCosting.IncludeLandedCosts, Items.Exception, DefaultFound, 2)  
	  var.ticpr007.spit  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.spit, ItemsCosting.SurchargesbyItem, Items.Exception, DefaultFound, 2)  
	  var.ticpr007.vpwh  =  ItemHandling.GetTypeEnum(ItemDefaultsCosting.vpwh, ItemsCosting.SurchargesByWH, Items.Exception, DefaultFound, 2)  
	   
	  dump 1
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cpr
:TFLNO:007
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsCosting
:ICOD:S
:QURY:START
select  	  ItemsCosting.*  , Items.ItemType, Items.ItemGroup
from 	  ItemsCosting, Items
where 	  ItemsCosting.Project  =  Items.Project  
and  	  ItemsCosting.Item  =  Items.Item
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cpr
:TFLNO:007
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemsCosting
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cpr
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSurchargesByItem
:ICOD:D
:QURY:START
	  dump 1  	  '  |  ticpr110 by Item
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cpr
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSurchargesByItem
:ICOD:S
:QURY:START
select ItemSurchargesByItem.*
from ItemSurchargesByItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cpr
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSurchargesByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cpr
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSurchargesByItemGroup
:ICOD:D
:QURY:START
	  dump 2  	  '  |  ticpr110 by ItemGroup
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cpr
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSurchargesByItemGroup
:ICOD:S
:QURY:START
select ItemSurchargesByItemGroup.*
from ItemSurchargesByItemGroup
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cpr
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ItemSurchargesByItemGroup
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cpr
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SimulatedPurchasePrices
:ICOD:D
:QURY:START
dump 170
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cpr
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SimulatedPurchasePrices
:ICOD:S
:QURY:START
select SimulatedPurchasePrices.*
from SimulatedPurchasePrices
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cpr
:TFLNO:170
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SimulatedPurchasePrices
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cst
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionOrderMaterials
:ICOD:D
:QURY:START
	  if ProductionOrders.BackflushMaterials  =  2 then  
	   	  var.ticst001.bfls  =  2  
	   	  var.ticst001.dris  =  ProductionOrderMaterials.DirectProcWHO  
	  else  
	   	  var.ticst001.bfls  =  ProductionOrderMaterials.Backflushing  
	   	  if var.ticst001.bfls  =  1 then  
	   	   	  var.ticst001.dris  =  1  
	   	  else  
	   	   	  var.ticst001.dris  =  ProductionOrderMaterials.DirectProcWHO  
	   	  end if  
	  end if  
	  dump 001
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cst
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionOrderMaterials
:ICOD:S
:QURY:START
select  	  ProductionOrderMaterials.*  , ProductionOrders.*
from 	  ProductionOrderMaterials, ProductionOrders
where 	  ProductionOrders.OrderNumber  =  ProductionOrderMaterials.ProductionOrder
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:cst
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionOrderMaterials
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:mfc
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AsBuiltHeadersAndComponents
:ICOD:D
:QURY:START
	  dump 010  
	  If prev.orno  <>  AsBuiltHeadersAndComponents.OrderNumber then  
	   	  dump 011  
	  End If  
	  prev.orno  =  AsBuiltHeadersAndComponents.OrderNumber
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:mfc
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AsBuiltHeadersAndComponents
:ICOD:S
:QURY:START
select AsBuiltHeadersAndComponents.*
from AsBuiltHeadersAndComponents
order by AsBuiltHeadersAndComponents.OrderNumber, AsBuiltHeadersAndComponents.Position
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:mfc
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AsBuiltHeadersAndComponents
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:pcf
:TFLNO:310
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GenericBOM
:ICOD:D
:QURY:START
	  var.tipcf310.indt  =  get.utc(GenericBOM.EffectiveDate,"yes")  
	  'var.tibom010.exdt  =  get.utc(BillOfMaterial.ExpiryDate,"no")  	   	   
	  If GenericBOM.ExpiryDate  =  "" or IsNull(GenericBOM.ExpiryDate) then  	   
	   	  var.tipcf310.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tipcf310.exdt  =  get.utc(GenericBOM.ExpiryDate,"no")  
	  end if  
	  dump 310
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:pcf
:TFLNO:310
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GenericBOM
:ICOD:S
:QURY:START
select  	  GenericBOM.*
from 	  GenericBOM
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:pcf
:TFLNO:310
:SCPAC:bc
:SCMOD:tbl
:SFLNO:GenericBOM
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:pcf
:TFLNO:520
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OptionsbyProductVariant
:ICOD:D
:QURY:START
	  dump 520
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:pcf
:TFLNO:520
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OptionsbyProductVariant
:ICOD:S
:QURY:START
select  	  OptionsbyProductVariant.*
from 	  OptionsbyProductVariant
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:pcf
:TFLNO:520
:SCPAC:bc
:SCMOD:tbl
:SFLNO:OptionsbyProductVariant
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionDepartment
:ICOD:D
:QURY:START
	  varstr.address  =  ProductionDepartment.Address  
	  select Addresses.City  
	  from Addresses  
	  where Addresses.AddressCode  =  varstr.address  
	  selectdo  
	  endselect  
	   
	  var.tcmcs065.city  =  Left(Addresses.City, 8)  
	   
	  if ProductionDepartment.EnterpriseUnit  =  "" or IsNull (ProductionDepartment.EnterpriseUnit) then  
	   	  var.EnterpriseUnit  =  GeneralParameters.DefaultEnterpriseUnit  
	  else  
	   	  var.EnterpriseUnit  =  ProductionDepartment.EnterpriseUnit  
	  end if  	   
	  dump 365 '  |  pddp tcmcs065  
	  dump 300 '  |  pddp tirou200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionDepartment
:ICOD:S
:QURY:START
select ProductionDepartment.*
from ProductionDepartment
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionDepartment
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Stations
:ICOD:D
:QURY:START
	  varstr.address  =  Stations.Address  
	  select Addresses.City  
	  from Addresses  
	  where Addresses.AddressCode  =  varstr.address  
	  selectdo  
	  endselect  
	  var.tiasl145.bfty  =  Stations.BufferType  
	  if Stations.StationType  =  5 then  	  '  |  Buffer  
	   	  if var.tiasl145.bfty  =  30 then  
	   	   	  var.tiasl145.bfty  =  10  
	   	  end if  
	   	  if var.tiasl145.bfty  =  10 then  	  '  |  Random Access Buffer  
	   	   	  var.tiasl145.nrap  =  Stations.NumberOfRAP  
	   	   	  var.tiasl145.obfu  =  Stations.OptimalBufferUtilization  
	   	  else  	   	   	   	  '  |  FIFO Buffer  
	   	   	  var.tiasl145.nrap  =  Stations.NumberOfRAP  
	   	   	  var.tiasl145.obfu  =  Stations.OptimalBufferUtilization  	   
	   	  end if  
	   	  var.tiasl145.oprc  =  ""  
	   	  var.tiasl145.sfwh  =  ""  
	   	  var.tiasl145.bfem  =  ""  
	  else  
	   	  if var.tiasl145.bfty  <>  30 then  
	   	   	  var.tiasl145.bfty  =  30  	  '  |  Not Applicable  
	   	  end if  
	   	  var.tiasl145.nrap  =  0  
	   	  var.tiasl145.obfu  =  0  
	   	  var.tiasl145.oprc  =  Stations.OperationRateCode  
	   	  var.tiasl145.sfwh  =  Stations.ShopFloorWarehouse  
	   	  var.tiasl145.obfu  =  Stations.BackflushEmployee  
	  end if  
	   
	  if Stations.EnterpriseUnit  =  "" or IsNull (Stations.EnterpriseUnit) then  
	   	  var.EnterpriseUnit  =  GeneralParameters.DefaultEnterpriseUnit  
	  else  
	   	  var.EnterpriseUnit  =  Stations.EnterpriseUnit  
	  end if  	   
	  if Stations.LogisticCompany  =  0 then  
	   	  var.LogisticCompany  =  GeneralParameters.TargetCompanyNumber  
	  else  
	   	  var.LogisticCompany  =  Stations.LogisticCompany  
	  end if  
	  if Stations.FinancialCompany  =  0 then  
	   	  var.FinancialCompany  =  GeneralParameters.TargetCompanyNumber  
	  else  
	   	  var.FinancialCompany  =  Stations.FinancialCompany  
	  end if  	   
	   
	  var.tcmcs065.city  =  Left(Addresses.City, 8)  	   
	  dump 145 '  |  tiasl145  -  Stations  
	  dump 965 '  |  tcmcs065  -  Stations
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Stations
:ICOD:S
:QURY:START
select  	  Stations.*
from 	  Stations
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Stations
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:D
:QURY:START
	  varstr.address  =  WorkCenter.Address  
	  select Addresses.City  
	  from  	  Addresses  
	  where Addresses.AddressCode  =  varstr.address  
	  selectdo  
	  endselect  
	   
	  var.tcmcs065.city  =  Left(Addresses.City, 8)  
	  dump 001 '  |  cwoc tirou001  
	  dump 065 '  |  cwoc tcmcs065  
	  dump 200 '  |  cwoc cprpd200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:S
:QURY:START
select WorkCenter.*
from WorkCenter
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WorkCenter
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Machine
:ICOD:D
:QURY:START
	  dump 002
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Machine
:ICOD:S
:QURY:START
select Machine.*
from Machine
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:002
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Machine
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProcessVariables
:ICOD:D
:QURY:START
	  dump 5
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProcessVariables
:ICOD:S
:QURY:START
select ProcessVariables.*
from ProcessVariables
order by ProcessVariables.ProcessVariable
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:005
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProcessVariables
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:D
:QURY:START
'  |   *  ERP  -  00000  -  51389.sn  
	  var.cycletime  =  RoutingOperation.CycleTime  
	  varstr.cprj  =  RoutingOperation.ManufacturedProject  
	  varstr.item  =  RoutingOperation.ManufacturedItem  
	  varstr.routing  =  RoutingOperation.Routing  
	  var.quantity  =  0  
'  |   *  ERP  -  00000  -  51389.en  
	  If varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select RoutingCodesByItem.RoutingQuantity  
	   	  from  	  RoutingCodesByItem  
	   	  where RoutingCodesByItem.ManufacturedItem  =  varstr.item  
	   	  and  	  RoutingCodesByItem.Routing  =  varstr.routing  
	   	  selectdo  
	   	   	  If RoutingCodesByItem.ManufacturedProject  =  "" or IsNull(RoutingCodesByItem.ManufacturedProject) then  
	   	   	   	  var.quantity  =  RoutingCodesByItem.RoutingQuantity  
	   	   	  End If  
	   	  endselect  
	  else  
	   	  select RoutingCodesByItem.RoutingQuantity  
	   	  from  	  RoutingCodesByItem  
	   	  where RoutingCodesByItem.ManufacturedProject  =  varstr.cprj  
	   	  and  	  RoutingCodesByItem.ManufacturedItem  =  varstr.item  
	   	  and  	  RoutingCodesByItem.Routing  =  varstr.routing  
	   	  selectdo  
	   	   	  var.quantity  =  RoutingCodesByItem.RoutingQuantity  
	   	  endselect  
	  End If  
'  |   *  ERP  -  00000  -  51389.sn  
	  if var.cycletime  >  "0" then  
	   	  if var.quantity  =  "0" then  
'  |  243218.o  	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime) ,2)  
	   	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime) ,2,0,0,0) '  |  243218.n  
	   	  else  
'  |  243218.o  	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime)  *  Cdbl(var.quantity) ,2)  
	   	   	  var.tirou102.prte  =  FormatNumber(60  /  Cdbl(var.cycletime)  *  Cdbl(var.quantity) ,2,0,0,0) '  |  243218.n  
	   	  end if  
	  else  
	   	  var.tirou102.prte  =  0  
	  end if  
'  |   *  ERP  -  00000  -  51389.en  
	  var.tirou102.indt  =  get.utc(RoutingOperation.EffectiveDate,"yes")  
	  If RoutingOperation.ExpiryDate  =  "" or IsNull(RoutingOperation.ExpiryDate)then  	   
	   	  var.tirou102.exdt  =  "1/19/2038"  
	  else  	   
	   	  var.tirou102.exdt  =  get.utc(RoutingOperation.ExpiryDate,"yes")  
	  end if  	   
	  dump 102 '  |  tirou102
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:S
:QURY:START
select RoutingOperation.*
from RoutingOperation
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:rou
:TFLNO:102
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RoutingOperation
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:sfc
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionOrders
:ICOD:D
:QURY:START
	  var.tisfc001.rdld  =  get.utc(ProductionOrders.RequestedDelDate, "yes")  
	  var.tisfc001.prdt  =  get.utc(ProductionOrders.ProductionStart, "yes")  
	  dump 001  
	  dump 151  
	  if ProductionOrders.ProjectPeg  <>  "" then  
	   	  dump 005  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:sfc
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionOrders
:ICOD:S
:QURY:START
select  	  ProductionOrders.*
from 	  ProductionOrders
order by ProductionOrders.OrderNumber
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:sfc
:TFLNO:001
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionOrders
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:sfc
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionOrderOperations
:ICOD:D
:QURY:START
	  if varstr.pdno  <>  ProductionOrderOperations.ProductionOrder then  
	   	  var.tisfc010.sopr  =  1  
	  else  
	   	  var.tisfc010.sopr  =  2  
	  end if  
	  varstr.pdno  =  ProductionOrderOperations.ProductionOrder  
	  var.cycletime  =  ProductionOrderOperations.CycleTime  
	  var.quantity  =  ProductionOrders.Quantity  
	  var.tisfc010.prte  =  FormatNumber(60  /  Cdbl(var.cycletime) ,2,0,0,0)  
	  var.tisfc010.prtm  =  FormatNumber(Cdbl(var.cycletime)  /  60  *  Cdbl(var.quantity) ,2,0,0,0)  
	  dump 010
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:sfc
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionOrderOperations
:ICOD:S
:QURY:START
select  	  ProductionOrderOperations.*  , ProductionOrders.*
from 	  ProductionOrderOperations, ProductionOrders
where 	  ProductionOrders.OrderNumber  =  ProductionOrderOperations.ProductionOrder
order by ProductionOrderOperations.ProductionOrder, ProductionOrderOperations.Operation
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ti
:TCMOD:sfc
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProductionOrderOperations
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ctm
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BankGuarantees
:ICOD:D
:QURY:START
	  if BankGuarantees.cprj  =  Previous.cprj then  
	   	  ' other records for same project  
	   	  var.tpctm020.seqn  =  var.tpctm020.seqn  +  1  
	  else  
	   	  ' new project restart sequence  
	   	  var.tpctm020.seqn  =  1  
	   	  Previous.cprj  =  BankGuarantees.cprj  
	  end if  
	  dump 1  	  '  |   *  tpctm020
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ctm
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BankGuarantees
:ICOD:S
:QURY:START
select BankGuarantees.*
from BankGuarantees
order by BankGuarantees.cprj, BankGuarantees.Pkey
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ctm
:TFLNO:020
:SCPAC:bc
:SCMOD:tbl
:SFLNO:BankGuarantees
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ctm
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContracts
:ICOD:D
:QURY:START
	  if ProjectContracts.SearchKey  <>  "" then  
	   	  var.tpctm100.seak  =  UCase(Left(ProjectContracts.SearchKey,16))  
	  else  
	   	  var.tpctm100.seak  =  UCase(Left(ProjectContracts.Description,16))  
	  end if  
	  var.tpctm100.codt  =  get.utc(ProjectContracts.ContractAwardDate, "no")  
	  var.tpctm100.efdt  =  get.utc(ProjectContracts.EffectiveDate, "no")  
	  var.tpctm100.exdt  =  get.utc(ProjectContracts.ExpiryDate, "no")  
	  dump 100
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ctm
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContracts
:ICOD:S
:QURY:START
select  	  ProjectContracts.*
from 	  ProjectContracts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ctm
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContracts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ctm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractLines
:ICOD:D
:QURY:START
	  if ProjectContractLines.Description  <>  "" then  
	   	  var.tpctm110.desc  =  ProjectContractLines.Description  
	  else  
	   	  var.tpctm110.desc  =  ProjectContracts.Description  
	  end if  
	  if ProjectContractLines.SearchKey  <>  "" then  
	   	  var.tpctm110.seak  =  UCase(Left(ProjectContractLines.SearchKey,16))  
	  else  
	   	  var.tpctm110.seak  =  UCase(Left(var.tpctm110.desc ,16))  
	  end if  
	  if ProjectContractLines.SoldtoBP  <>  "" then  
	   	  var.tpctm110.ofbp  =  ProjectContractLines.SoldtoBP  
	  else  
	   	  var.tpctm110.ofbp  =  ProjectContracts.SoldtoBP  
	  end if  
	  if ProjectContractLines.ContractAwardDate  <>  "" then  
	   	  var.tpctm110.codt  =  get.utc(ProjectContractLines.ContractAwardDate, "no")  
	  else  
	   	  var.tpctm110.codt  =  get.utc(ProjectContracts.ContractAwardDate, "no")  
	  end if  
	  if ProjectContractLines.EffectiveDate  <>  "" then  
	   	  var.tpctm110.efdt  =  get.utc(ProjectContractLines.EffectiveDate, "no")  
	  else  
	   	  var.tpctm110.efdt  =  get.utc(ProjectContracts.EffectiveDate, "no")  
	  end if  
	  if ProjectContractLines.ExpiryDate  <>  "" then  
	   	  var.tpctm110.exdt  =  get.utc(ProjectContractLines.ExpiryDate, "no")  
	  else  
	   	  var.tpctm110.exdt  =  get.utc(ProjectContracts.ExpiryDate, "no")  
	  end if  
	  if ProjectContractLines.Project  <>  "" then  
	   	  var.tpctm110.cprj  =  ProjectContractLines.Project  
	  else  
	   	  var.tpctm110.cprj  =  ProjectContracts.Project  
	  end if  
	   
	  dump 110
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ctm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractLines
:ICOD:S
:QURY:START
select  	  ProjectContractLines.*  , ProjectContracts.*
from 	  ProjectContractLines, ProjectContracts
where 	  ProjectContracts.Contract  =  ProjectContractLines.Contract
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ctm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractLines
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:D
:QURY:START
	  if CDbl(StandardSubcontractings.pric)  >  0 then  
	   	  var.tppdm035.ltpc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltpc  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSubcontractings.pris)  >  0 then  
	   	  var.tppdm035.ltps  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltps  =  get.utc("","no")  
	  end if  
	  if CDbl(StandardSubcontractings.prip)  >  0 then  
	   	  var.tppdm035.ltpp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm035.ltpp  =  get.utc("","no")  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:S
:QURY:START
select StandardSubcontractings.*
from StandardSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:035
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:090
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardElements
:ICOD:D
:QURY:START
	  var.prin  =  StandardElements.prin  
	  '  |  Condition for field 'Progress for Invoice'  
	  var.cspt  =  StandardElements.cspt  
	  if var.prin  =  3 then  	  '  |  Project Physical Progress  
	   	  var.cspt  =  2  	  '  |  Indirect  
	  end if  
	  if var.prin  =  4 then  	  '  |  Not Applicable  
	   	  var.cspt  =  3  	  '  |  Not Applicable  
	  end if  
	  '  |  Condition for field 'To Be Settled'  
	  var.setl  =  2  
	  if var.prin  =  1 then  
	   	  var.setl  =  StandardElements.setl  
	  end if  
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:090
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardElements
:ICOD:S
:QURY:START
select StandardElements.*
from StandardElements
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:090
:SCPAC:bc
:SCMOD:tbl
:SFLNO:StandardElements
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:600
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:D
:QURY:START
	  if Projects.btco  =  1 then  
	   	  var.tppdm600.cmog  =  2  
	  else  
	   	  var.tppdm600.cmog  =  3  
	  end if  
	  if Projects.intp  =  1 then  
	   	  var.tppdm600.ipin  =  2  
	  else  
	   	  var.tppdm600.ipin  =  1  
	  end if  
	  var.tppdm600.rate  =  Projects.rate  
	  if trim(var.tppdm600.rate)  =  "" or IsNull(var.tppdm600.rate) then  
	   	  var.tppdm600.rate  =  1  
	  end if  
	  if Projects.revr  =  2 then  	   	   	   	   	   	   	   	   
	  var.tppdm600.cmpc  =  10 '  |   *  Cost to Cost  
	  else  
	  var.tppdm600.cmpc  =  200 '  |   *  Not Applicable  
	  end if  
	  if Projects.cogs  =  2 then  
	  var.tppdm600.bfpp  =  10 '  |  Estimate at completion  
	  else  
	  var.tppdm600.bfpp  =  100 '  |  Not Applicable  
	  end if  	   	   	   	   	   	   	   	   	   	   
	   
	  var.tppdm600.guid  =  "MIG_tppdm600_"  &  Projects.cprj  	   
	  dump 600  	  '  |  tppdm600  
	  dump 052  	  '  |  tcmcs052
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:600
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:S
:QURY:START
select Projects.*
from Projects
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:600
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Projects
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:D
:QURY:START
	  if CDbl(ProjectSubcontractings.pric)  >  0 then  
	   	  var.tppdm635.ltpc  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltpc  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSubcontractings.pris)  >  0 then  
	   	  var.tppdm635.ltps  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltps  =  get.utc("","no")  
	  end if  
	  if CDbl(ProjectSubcontractings.prip)  >  0 then  
	   	  var.tppdm635.ltpp  =  get.utc(date(),"no")  
	  else  
	   	  var.tppdm635.ltpp  =  get.utc("","no")  
	  end if  
	  dump 01  	  '  |   *  tppdm635
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:S
:QURY:START
select ProjectSubcontractings.*
from ProjectSubcontractings
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:635
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectSubcontractings
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:700
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractDeliverables
:ICOD:D
:QURY:START
	  var.tppdm700.rddt  =  get.utc(ProjectContractDeliverables.ContractDeliveryDate, "no")  
	  var.tppdm700.cddt  =  get.utc(ProjectContractDeliverables.ConfirmedDeliveryDate, "no")  
	  var.tppdm700.pddt  =  get.utc(ProjectContractDeliverables.PlannedDeliveryDate, "no")  
	  var.tppdm700.prdt  =  get.utc(ProjectContractDeliverables.PlannedReceiptDate, "no")  
	  dump 700
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:700
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractDeliverables
:ICOD:S
:QURY:START
select  	  ProjectContractDeliverables.*
from 	  ProjectContractDeliverables
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pdm
:TFLNO:700
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectContractDeliverables
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ppc
:TFLNO:211
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectCosts
:ICOD:D
:QURY:START
	  var.tpppc2xx.rgdt  =  get.utc(ProjectCosts.RegistrationDate, "no")  
'  	  var.quan  =  ProjectCosts.Quantity  
'  	  var.cost  =  ProjectCosts.UnitCost  
'  	  var.tpppc2xx.amoc  =  (var.quan  *  var.cost)  
	  if ProjectCosts.CostType  =  1 then  
	   	  dump 231  
	  end if  
	  if ProjectCosts.CostType  =  2 then  
	   	  dump 211  
	  end if  
	  if ProjectCosts.CostType  =  3 then  
	   	  dump 251  
	  end if  
	  if ProjectCosts.CostType  =  4 then  
	   	  dump 271  
	  end if  
	  if ProjectCosts.CostType  =  5 then  
	   	  dump 291  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ppc
:TFLNO:211
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectCosts
:ICOD:S
:QURY:START
select  	  ProjectCosts.*
from 	  ProjectCosts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ppc
:TFLNO:211
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectCosts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ppc
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectRevenueEntry
:ICOD:D
:QURY:START
	  var.tpppc301.rgdt  =  get.utc(ProjectRevenueEntry.RegistrationDate, "no")  
	  dump 301
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ppc
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectRevenueEntry
:ICOD:S
:QURY:START
select  	  ProjectRevenueEntry.*
from 	  ProjectRevenueEntry
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ppc
:TFLNO:301
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ProjectRevenueEntry
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pss
:TFLNO:230
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ExternalScheduleLinks
:ICOD:D
:QURY:START
	  dump 01
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pss
:TFLNO:230
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ExternalScheduleLinks
:ICOD:S
:QURY:START
select ExternalScheduleLinks.*
from ExternalScheduleLinks
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:pss
:TFLNO:230
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ExternalScheduleLinks
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:D
:QURY:START
	  var.prin  =  Elements.prin  
	  '  |  Condition for field 'Progress for Invoice'  
	  var.cspt  =  Elements.cspt  
	  if var.prin  =  2 then  	  '  |  No  
	   	  var.cspt  =  3  	  '  |  Not Applicable  
	  end if  
	  if var.prin  =  3 then  	  '  |  Project Physical Progress  
	   	  var.cspt  =  2  	  '  |  Indirect  
	  end if  
	  '  |  Condition for field 'To Be Settled'  
	  var.setl  =  2  
	  if var.prin  =  1 and var.cspt  =  1 then  
	   	  var.setl  =  Elements.setl  
	  end if  
	  dump 01  	  '  |   *  tpptc100
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:S
:QURY:START
select Elements.*
from Elements
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tp
:TCMOD:ptc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Elements
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:acm
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ReferenceActivities
:ICOD:D
:QURY:START
dump 101
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:acm
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ReferenceActivities
:ICOD:S
:QURY:START
select ReferenceActivities.*
from ReferenceActivities
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:acm
:TFLNO:101
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ReferenceActivities
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:acm
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ResourceRequirementsByReferenceActivity
:ICOD:D
:QURY:START
dump 220
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:acm
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ResourceRequirementsByReferenceActivity
:ICOD:S
:QURY:START
select ResourceRequirementsByReferenceActivity.*
from ResourceRequirementsByReferenceActivity
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:acm
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ResourceRequirementsByReferenceActivity
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:acm
:TFLNO:360
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MeasurementTypesByReferenceActvity
:ICOD:D
:QURY:START
dump 360
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:acm
:TFLNO:360
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MeasurementTypesByReferenceActvity
:ICOD:S
:QURY:START
select MeasurementTypesByReferenceActvity.*
from MeasurementTypesByReferenceActvity
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:acm
:TFLNO:360
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MeasurementTypesByReferenceActvity
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:cfg
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SerializedItems
:ICOD:D
:QURY:START
if SerializedItems.SearchKey  <>  "" then  
	  var.tscfg200.sear  =  UCase(Left(SerializedItems.SearchKey, 16))  
else  
	  var.tscfg200.sear  =  UCase(Left(SerializedItems.Description, 16))  
end if  
dump 200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:cfg
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SerializedItems
:ICOD:S
:QURY:START
select SerializedItems.*
from SerializedItems
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:cfg
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SerializedItems
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:ctm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ConfigurationLines
:ICOD:D
:QURY:START
	  dump 110 '  |  Configuration Lines  
	  if ConfigurationLines.FixedPrice  =  1 then  
	   	  dump 111 '  |  Fixed price lines  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:ctm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ConfigurationLines
:ICOD:S
:QURY:START
select  	  ConfigurationLines.*
from 	  ConfigurationLines
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:ctm
:TFLNO:110
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ConfigurationLines
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:ctm
:TFLNO:120
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceContractTerms
:ICOD:D
:QURY:START
	  dump 120 '  |   #  Coverage Terms  
	  if ServiceContractTerms.TermType  =  20 then  
	   	  dump 130 '  |   #  Travel Terms  
	  end if  
	  if ServiceContractTerms.TermType  =  5 then  
	   	  if ServiceContractTerms.Item  <>  "" or  	  ServiceContractTerms.ServiceItemGroup  <>  "" then  
	   	   	  if ServiceContractTerms.CostAmount  =  0 then  
	   	   	   	  var.tsctm131.camt  =  ServiceContractTerms.Quantity  *  ServiceContractTerms.CostPrice  
	   	   	  else  
	   	   	   	  var.tsctm131.camt  =  ServiceContractTerms.CostAmount  
	   	   	  end if  
	   	   	  if ServiceContractTerms.SalesAmount  =  0 then  
	   	   	   	  var.tsctm131.amnt  =  ServiceContractTerms.Quantity  *  ServiceContractTerms.SalesPrice  
	   	   	  else  
	   	   	   	  var.tsctm131.amnt  =  ServiceContractTerms.SalesAmount  
	   	   	  end if  
	   	   	  dump 131 '  |   #  Material Terms  
	   	  end if  
	  end if  
	  if ServiceContractTerms.TermType  =  10 and ServiceContractTerms.Task  <>  "" then  
	   	  if ServiceContractTerms.CostAmount  =  0 then  
	   	   	  var.tsctm132.camt  =  ServiceContractTerms.Quantity  *  ServiceContractTerms.CostPrice  
	   	  else  
	   	   	  var.tsctm132.camt  =  ServiceContractTerms.CostAmount  
	   	  end if  
	   	  if ServiceContractTerms.SalesAmount  =  0 then  
	   	   	  var.tsctm132.amnt  =  ServiceContractTerms.Quantity  *  ServiceContractTerms.SalesPrice  
	   	  else  
	   	   	  var.tsctm132.amnt  =  ServiceContractTerms.SalesAmount  
	   	  end if  	   
	   	  dump 132 '  |   #  Labor Terms  
	  end if  	   
	  if ServiceContractTerms.TermType  =  30 then  
	   	  if ServiceContractTerms.CostAmount  =  0 then  
	   	   	  var.tsctm135.camt  =  ServiceContractTerms.NoHelpDeskCalls  *  ServiceContractTerms.CostPrice  
	   	  else  
	   	   	  var.tsctm135.camt  =  ServiceContractTerms.CostAmount  
	   	  end if  
	   	  if ServiceContractTerms.SalesAmount  =  0 then  
	   	   	  var.tsctm135.amnt  =  ServiceContractTerms.NoHelpDeskCalls  *  ServiceContractTerms.SalesPrice  
	   	  else  
	   	   	  var.tsctm135.amnt  =  ServiceContractTerms.SalesAmount  
	   	  end if  	   	   
	   	  dump 135 '  |   #  Help desk Terms  
	  end if  
	  if ServiceContractTerms.TermType  =  15 or ServiceContractTerms.TermType  =  25 or ServiceContractTerms.TermType  =  35 then  
	   	  dump 136 '  |   #  Other Terms  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:ctm
:TFLNO:120
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceContractTerms
:ICOD:S
:QURY:START
select  	  ServiceContractTerms.*  , ServiceContracts.*
from 	  ServiceContractTerms, ServiceContracts
where 	  ServiceContractTerms.Contract  =  ServiceContracts.Contract
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:ctm
:TFLNO:120
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceContractTerms
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:ctm
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceContracts
:ICOD:D
:QURY:START
	  dump 300  
	  dump 320
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:ctm
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceContracts
:ICOD:S
:QURY:START
select  	  ServiceContracts.*
from 	  ServiceContracts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:ctm
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceContracts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:mdm
:TFLNO:060
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MeasurementUnits
:ICOD:D
:QURY:START
dump 60
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:mdm
:TFLNO:060
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MeasurementUnits
:ICOD:S
:QURY:START
select MeasurementUnits.*
from MeasurementUnits
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:mdm
:TFLNO:060
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MeasurementUnits
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:mdm
:TFLNO:065
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MeasurementTypes
:ICOD:D
:QURY:START
dump 65
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:mdm
:TFLNO:065
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MeasurementTypes
:ICOD:S
:QURY:START
select MeasurementTypes.*
from MeasurementTypes
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:mdm
:TFLNO:065
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MeasurementTypes
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:mdm
:TFLNO:068
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaintenanceTriggerSets
:ICOD:D
:QURY:START
dump 68
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:mdm
:TFLNO:068
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaintenanceTriggerSets
:ICOD:S
:QURY:START
select MaintenanceTriggerSets.*
from MaintenanceTriggerSets
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:mdm
:TFLNO:068
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaintenanceTriggerSets
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:mdm
:TFLNO:069
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaintenanceTriggers
:ICOD:D
:QURY:START
dump 69
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:mdm
:TFLNO:069
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaintenanceTriggers
:ICOD:S
:QURY:START
select MaintenanceTriggers.*
from MaintenanceTriggers
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:mdm
:TFLNO:069
:SCPAC:bc
:SCMOD:tbl
:SFLNO:MaintenanceTriggers
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:soc
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceOrders
:ICOD:D
:QURY:START
	  if ServiceOrders.SoldToBP  <>  "" then  
	   	  var.tssoc200.corn  =  ServiceOrders.CustomerOrder  
	   	  var.tssoc200.refa  =  ServiceOrders.FirstRef  
	   	  var.tssoc200.refb  =  ServiceOrders.SecondRef  
	   	  var.tssoc200.pmtd  =  ServiceOrders.PricingMethod  
	   	  var.tssoc200.espr  =  ServiceOrders.SalesPrice  
	  else  
	   	  var.tssoc200.corn  =  ""  
	   	  var.tssoc200.refa  =  ""  
	   	  var.tssoc200.refb  =  ""  
	   	  var.tssoc200.pmtd  =  5  	   	  '  |   *  Not Applicable  
	   	  var.tssoc200.espr  =  0  
	  end if  
	  dump 200 '  |   *  tssoc200
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:soc
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceOrders
:ICOD:S
:QURY:START
select  	  ServiceOrders.*
from 	  ServiceOrders
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:soc
:TFLNO:200
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceOrders
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:soc
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceOrderActivities
:ICOD:D
:QURY:START
	  dump 210
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:soc
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceOrderActivities
:ICOD:S
:QURY:START
select  	  ServiceOrderActivities.*
from 	  ServiceOrderActivities
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:soc
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceOrderActivities
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:soc
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceOrderCosts
:ICOD:D
:QURY:START
	  if ServiceOrderCosts.CostType  =  10 then  
	   	  dump 220  
	  end if  
	  if ServiceOrderCosts.CostType  =  20 then  
	   	  dump 230  
	  end if  
	  if ServiceOrderCosts.CostType  =  30 then  
	   	  dump 240  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:soc
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceOrderCosts
:ICOD:S
:QURY:START
select  	  ServiceOrderCosts.*
from 	  ServiceOrderCosts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:soc
:TFLNO:220
:SCPAC:bc
:SCMOD:tbl
:SFLNO:ServiceOrderCosts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:spc
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PreventiveMaintenanceScenario
:ICOD:D
:QURY:START
dump 130
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:spc
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PreventiveMaintenanceScenario
:ICOD:S
:QURY:START
select PreventiveMaintenanceScenario.*
from PreventiveMaintenanceScenario
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:spc
:TFLNO:130
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PreventiveMaintenanceScenario
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:spc
:TFLNO:131
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PreventiveMaintenanceScenarioLines
:ICOD:D
:QURY:START
dump 131
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:spc
:TFLNO:131
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PreventiveMaintenanceScenarioLines
:ICOD:S
:QURY:START
select PreventiveMaintenanceScenarioLines.*
from PreventiveMaintenanceScenarioLines
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:spc
:TFLNO:131
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PreventiveMaintenanceScenarioLines
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:spc
:TFLNO:132
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PreventiveMaintenanceScenarioLinePatterns
:ICOD:D
:QURY:START
	  dump 132
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:spc
:TFLNO:132
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PreventiveMaintenanceScenarioLinePatterns
:ICOD:S
:QURY:START
select PreventiveMaintenanceScenarioLinePatterns.*
from PreventiveMaintenanceScenarioLinePatterns
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:spc
:TFLNO:132
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PreventiveMaintenanceScenarioLinePatterns
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:spc
:TFLNO:135
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RuleBookForMaintenanceScenarios
:ICOD:D
:QURY:START
dump 135
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:spc
:TFLNO:135
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RuleBookForMaintenanceScenarios
:ICOD:S
:QURY:START
select RuleBookForMaintenanceScenarios.*
from RuleBookForMaintenanceScenarios
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:ts
:TCMOD:spc
:TFLNO:135
:SCPAC:bc
:SCMOD:tbl
:SFLNO:RuleBookForMaintenanceScenarios
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:D
:QURY:START
	  if Texts.TextID  <>  "NULL" then  
	   	  TextLength  =  len(Texts.Text )  
	   	  TextNumber  =  Texts.TextID  
	   	  TextSequence  =  1  
	   	  HEXcode  =  Right("00000000"  &  Hex(TextNumber), 8)  
	   	  for p  =  1 To 7 Step 2  
	   	   	  VarTextNumber  =  VarTextNumber  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	  next  
	   	  HEXcode  =  right ( "00000000"  &  HEX ( TextSequence ) , 8 )  
	   	  for p  =  1 to 7 Step 2  
	   	   	  VarTextSequence  =  VarTextSequence  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	  next  
	   	  i  =  1  
	   	  PrevPos  =  i  
	   	  NumOfCharacters  =  0  
	   	  Do while i  <=  TextLength  
	   	   	  '  |  TextBox needs to be split in multiple text lines  
	   	   	  TextCharacter  =  MID(Texts.Text ,i,1)  
	   	   	  if (NumOfCharacters  >=  240) then  
	   	   	   	  '  |  Create current text as a sequence line.  
	   	   	   	  TextString  =  TextString  +  EndTextString  
	   	   	   	  dump 1  	  '  |   **  TTTXT010  	   
	   	   	   	   
	   	   	   	  '  |  reset fields for next text sequence line.  
	   	   	   	  TextString  =  ""  	   	   	   
	   	   	   	  VarTextNumber  =  ""  	   	   	   
	   	   	   	  VarTextSequence  =  ""  	   	   
	   	   	   	  TextSequence  =  TextSequence  +  1  
	   	   	   	  PrevPos  =  i  
	   	   	   	  NumOfCharacters  =  0  
	   	   	   	   
	   	   	   	  HEXcode  =  Right("00000000"  &  Hex(TextNumber), 8)  
	   	   	   	  for p  =  1 To 7 Step 2  
	   	   	   	   	  VarTextNumber  =  VarTextNumber  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	   	   	  next  
	   	   	   	  HEXcode  =  right ( "00000000"  &  HEX ( TextSequence ) , 8 )  
	   	   	   	  for p  =  1 to 7 Step 2  
	   	   	   	   	  VarTextSequence  =  VarTextSequence  &  Chr(CLng("&H"  &  Mid(HEXcode, p, 2)))  	   
	   	   	   	  next  
	   	   	  end if  
	   	   
	   	   	   
	   	   	  '  |  Check for Enter in text  
	   	   	  if (ASC (TextCharacter)  =  13) then  
	   	   	   	  TextCharacter  =  CHR(10)  	   	   	   
	   	   	   	  i  =  i  +  2  
	   	   	  else  
	   	   	   	  TextCharacter  =  TextCharacter  	   	   
	   	   	   	  i  =  i  +  1  
	   	   	  end if  
	   	  ' |  #  Checking on Tab no longer required.  	   	   	   	  ' |  # LN10605.so  
	   	  ' |  #  '  |  Check for TAB in text  
	   	  ' |  #   	  if (ASC (TextCharacter)  =  9) then  
	   	  ' |  #   	   	  CHRspace  =  CHR (32)  
	   	  ' |  #   	   	  TextCharacter  =  ""  	   	   	   	   	   	   	   
	   	  ' |  #   	   	  for p  =  1 to 6  	   	  '  |  Replace TAB with 6 spaces  	   	   	   	   
	   	  ' |  #   	   	   	  TextCharacter  =  TextCharacter  +  CHRspace  	   	   	   
	   	  ' |  #   	   	  next  	   
	   	  ' |  #   	   	  NumOfCharacters  =  NumOfCharacters  +  5  	   	   	   	   	   
	   	  ' |  #   	  end if  	   
	   	  ' |  #   	  TextString  =  TextString  +  TextCharacter  
	   	  ' |  #   	  NumOfCharacters  =  NumOfCharacters  +  1  	   	   	  ' |  # LN10605.eo  
	   	  loop  
	   	   
	   	  '  |  Text line is maximum of 239 and fits in 1 text line  
	   	  if TextLength MOD 240  <>  0 then  	   	   	   	   	   	  '  |   #  1948726.sn  
	   	   	  TextString  =  TextString  +  CHR (10) '  |  Close Character of the string  
	   	  end if  	   	   	   	   	   	   	   	   	  '  |   #  1948726.en  	   	   	   	   	   
	   	  '  |  Fill up the remainder of the string with spaces  
	   	  '  |  240  =  NumOfCharacters  +  Close chararter  +  NrOfSpaces  
	   	  NrOfSpaces  =  239  -  NumOfCharacters  	   	   	   	   
	   	  CHRspace  =  CHR ( 32 )  	   	   	   	   	   	   	   	   	   
	   	  for p  =  1 to NrOfSpaces  	   	   	   	   	   	   	   	   
	   	   	  TextString  =  TextString  +  CHRspace  	   	   	   	   
	   	  next  	   	   	   	   	   	   	   	   
	   	   	   	   	   	   	   	   
	   	  TextString  =  TextString  +  EndTextString  
	   	   
	   	  dump 1  	   	  '  |   **  TTTXT010  
	   	  TextString  =  ""  	   	   	   	   	   	   	   
	   	  VarTextNumber  =  ""  	   	   	   	   	   	   	   
	   	  VarTextSequence  =  ""  	   	   	   	   	   	   
	   	  dump 2  	   	  '  |   **  TTTXT002  
	   	  dump 3  	   	  '  |   **  TTTXT001  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:S
:QURY:START
select  	  Texts.*
from 	  Texts
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:tt
:TCMOD:txt
:TFLNO:010
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Texts
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:inh
:TFLNO:520
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AdjustmentOrders
:ICOD:D
:QURY:START
	  varstr.cwar  =  AdjustmentOrders.Warehouse  
	  varstr.item  =  AdjustmentOrders.Item  
	  varstr.cprj  =  AdjustmentOrders.Project  
	  varstr.temp  =  read.item.settings(varstr.item, varstr.cprj, var.location.controlled, var.lot.controlled, var.serialized, var.lots.in.inv, var.serials.in.inv)  
	  'If AdjustmentOrders.Warehouse  <>  prev.warehouse then  	   	   	   	   	   	   	  'LN10605.o  
	  If (AdjustmentOrders.Warehouse  <>  prev.warehouse) or (varint.position  =  9990) then  	   	   	   	  'LN10605.n  
	   	  ' start new adjustment case of warehouse change or positions used  	   	   	   	   	  'LN10605.n  
	   	  varint.position  =  10  
	   	  varint.counter  =  varint.counter  +  1  
	   	  varstr.order.number  =  generate.order.number(varstr.series, varint.counter)  
	   	  dump 520 '  |  Adjustment Order Headers  
	  End If  
	  '  |   *  The 'Inventory Price' check box is only available if both of the following conditions apply:  
	   	  '  |  1  -  The adjustment  -  order line concerns a positive variance.  
	   	  '  |  2  -  The item's inventory  -  valuation method is not 'Fixed Transfer Price (FTP)' (whwmd210.valm).  
	  varint.valm  =  get.inventory.valuation.method(varstr.cwar, varstr.cprj, varstr.item)  
	  if varint.valm  <>  1 then  
	   	  var.adjustment.price  =  AdjustmentOrders.AdjustmentPrice  
	  else  
	   	  var.adjustment.price  =  0  
	  end if  
	  if var.adjustment.price  =  0 or IsNull(var.adjustment.price) then  
	   	  var.use.price  =  2  	  '  |  No  
	  else  
	   	  var.use.price  =  1  	  '  |  Yes  
	  end if  
	  '  |   *  Determine if Location is permitted for this item  
	  varstr.location  =  AdjustmentOrders.Location  
	  if var.location.controlled  =  2 then  
	   	  varstr.location  =  ""  
	  end if  
	  '  |   *  Determine if Lot is permitted for this item  
	  '  |   *  The field 'Lots in Inventory' (whwmd400.linv) is always set to "yes" in case of a Lot Controlled item.  
	  '  |   *  That means it is mandatory to fill a Lot in whinh521  !   
	  varstr.clot  =  AdjustmentOrders.Lot  
	  if var.lot.controlled  =  2 then  	   
	   	  var.whinh521.clot  =  ""  
	  else  
	   	  var.whinh521.clot  =  varstr.clot  	   	   
	  end if  
	  '  |  Ownership variables non  -  serialized items  
	  var.whinh521.istr  =  90 '  |  Not Applicable  
	  var.whinh521.iown  =  90 '  |  Not Applicable  
	  var.whinh521.dpby  =  90 '  |  Not Applicable  
	  varstr.serial  =  AdjustmentOrders.SerialNumber  
	  if var.serialized  =  1 and trim(varstr.serial)  <>  "" then  
	   	  '  |   *  The Lot field in table whinh526 (Adjustment Order Line Lots and Serials) is only applicable in case the setting 'Lots in Inventory' is not set (whwmd400.linv)  !   
	   	  '  |   *  In case of a Serialized item you have to enter the serial numbers (must be unique  !  ) in table whinh526.  
	   	  if var.lots.in.inv  =  1 then  
	   	   	  var.whinh521.clot  =  varstr.clot  
	   	   	  var.whinh526.clot  =  ""  
	   	  else  
	   	   	  var.whinh521.clot  =  ""  
	   	   	  var.whinh526.clot  =  varstr.clot  
	   	  end if  
	   	  if var.serials.in.inv  =  1 then  
	   	   	  var.whinh526.stat  =  1  	  '  |  Initial  
	   	  else  	   
	   	   	  var.whinh526.stat  =  20  	  '  |  Not Applicable  
	   	  end if  
	   	   
	   	  if (varstr.cwar  =  prev.warehouse) and (varstr.cprj  <>  prev.project or varstr.item  <>  prev.item) then  
	   	   	  var.quantity  =  determine.total.line.quantity(varstr.cwar, varstr.cprj, varstr.item)  
	   	   	  if var.serials.in.inv  =  1 then  
	   	   	   	  var.whinh521.istr  =  10 '  |  Free  
	   	   	   	  var.whinh521.iown  =  10 '  |  Company Owned or Consigned  
	   	   	   	  var.whinh521.dpby  =  20 '  |  Own Company  
	   	   	  end if  
	   	   	  'varint.position  =  varint.position  +  10  	   	   	   	   	   	   	  'LN10605.o  
	   	   	  varint.position  =  varint.position  +  1  	   	   	   	   	   	   	  'LN10605.n  
	   	   	   
	   	   	  if AdjustmentOrders.InventoryDate  =  "1/1/1970" then  	   	   	   	   	   	  'LN10605.sn  
	   	   	   	  var.whinh521.idat  =  get.utc("", "no")  
	   	   	  else  
	   	   	   	  var.whinh521.idat  =  get.utc(AdjustmentOrders.InventoryDate, "no")  
	   	   	  end if  	   	   	   	   	   	   	   	   	   	  'LN10605.en  
	   	   	   
	   	   	  dump 521 '  |  Adjustment Order Line  
	   	  end if  
	   	  if varint.position  =  prev.position then  
	   	   	  var.whinh526.dssq  =  var.whinh526.dssq  +  1  
	   	  else  
	   	   	  var.whinh526.dssq  =  1  
	   	  end if  
	   	  dump 526 '  |  Adjustment Order Line Lots and Serials  
	  else  
	   	  var.quantity  =  AdjustmentOrders.Quantity  
	   	  If AdjustmentOrders.Warehouse  =  prev.warehouse then  
	   	   	  'varint.position  =  varint.position  +  10  	   	   	   	   	   	   	  'LN10605.o  
	   	   	  varint.position  =  varint.position  +  1  	   	   	   	   	   	   	  'LN10605.n  
	   	  End If  
	   	  if var.lots.in.inv  =  2 and var.lot.controlled  =  1 and trim(varstr.clot)  <>  "" then  
	   	   	  '  |  When 'Lots in inventory' is 'no' and items is not serialized then always 1 line in whinh526 to register the lot  
	   	   	  '  |  and the Lot field in whinh521 must be empty.  
	   	   	  var.whinh521.clot  =  ""  
	   	   	  var.whinh526.clot  =  varstr.clot  
	   	   	  var.whinh526.stat  =  20  
	   	   	  var.whinh526.dssq  =  1  
	   	   	  dump 526 '  |  Adjustment Order Line Lots and Serials  
	   	  end if  
	   	   
	   	  if AdjustmentOrders.InventoryDate  =  "1/1/1970" then  	   	   	   	   	   	  'LN10605.sn  
	   	   	  var.whinh521.idat  =  get.utc("", "no")  
	   	  else  
	   	   	  var.whinh521.idat  =  get.utc(AdjustmentOrders.InventoryDate, "no")  
	   	  end if  	   	   	   	   	   	   	   	   	   	  'LN10605.en  	   	   
	   	   
	   	  dump 521 '  |  Adjustment Order Line  
	  end if  
	  prev.warehouse  	   =  AdjustmentOrders.Warehouse  
	  prev.project  	   =  AdjustmentOrders.Project  
	  prev.item  	   	   =  AdjustmentOrders.Item  
	  prev.position  	   =  varint.position  
	  '  |   *  COMMENTS  
	  '  |   *  It is not necessary to fill table whinh525 (Adjustment Order Line Ownership)  
	  '  |   *  because this table will be automatically filled by the system as soon as the adjustment orders will be processed.  
	
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:inh
:TFLNO:520
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AdjustmentOrders
:ICOD:S
:QURY:START
select AdjustmentOrders.*
from 	  AdjustmentOrders
order by AdjustmentOrders.Warehouse, AdjustmentOrders.Project, AdjustmentOrders.Item, AdjustmentOrders.Lot, AdjustmentOrders.SerialNumber
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:inh
:TFLNO:520
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AdjustmentOrders
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:D
:QURY:START
	  var.whltc100.ldat  =  LotsByItem.LotDate  
	  if var.whltc100.ldat  =  "" or IsNull(var.whltc100.ldat) then  
	   	  var.whltc100.ldat  =  Date()  
	  end if  
	  dump 100 '  |  Lots
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:S
:QURY:START
select  	  LotsByItem.*
from 	  LotsByItem
order by LotsByItem.Project, LotsByItem.Item, LotsByItem.Lot
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:ltc
:TFLNO:100
:SCPAC:bc
:SCMOD:tbl
:SFLNO:LotsByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:ltc
:TFLNO:500
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SerialsByWarehouse
:ICOD:D
:QURY:START
	  dump 500
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:ltc
:TFLNO:500
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SerialsByWarehouse
:ICOD:S
:QURY:START
select SerialsByWarehouse.*
from SerialsByWarehouse
order by SerialsByWarehouse.Item, SerialsByWarehouse.SerialNumber, SerialsByWarehouse.Warehouse
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:ltc
:TFLNO:500
:SCPAC:bc
:SCMOD:tbl
:SFLNO:SerialsByWarehouse
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:D
:QURY:START
	  varstr.cprj  =  WarehouseItem.Project  
	  varstr.item  =  WarehouseItem.Item  
	  var.whwmd210.ialt  =  20  
	  if varstr.cprj  =  "" or IsNull(varstr.cprj) then  
	   	  select Items.LocationControlled  
	   	  from Items  
	   	  where Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  If Items.Project  =  "" or IsNull(Items.Project) then  
	   	   	   	  If Items.LocationControlled  =  1 then  
	   	   	   	   	  var.whwmd210.ialt  =  5  
	   	   	   	  else  
	   	   	   	   	  var.whwmd210.ialt  =  20  
	   	   	   	  End If  
	   	   	  End If  
	   	  endselect  
	  else  
	   	  select Items.LocationControlled  
	   	  from  	  Items  
	   	  where Items.Project  =  varstr.cprj  
	   	  and  	  Items.Item  =  varstr.item  
	   	  selectdo  
	   	   	  if Items.LocationControlled  =  1 then  
	   	   	   	  var.whwmd210.ialt  =  5  
	   	   	  else  
	   	   	   	  var.whwmd210.ialt  =  20  
	   	   	  end if  
	   	  endselect  
	  end if  
	   
	  if (WarehouseItem.OrderQuantityIncrement  <=  "0") then  
	   	  var.oqmf  =  1  
	  else  
	   	  var.oqmf  =  WarehouseItem.OrderQuantityIncrement  
	  end if  
	  if (WarehouseItem.MinimumOrderQuantity  <=  "0") then  
	   	  var.mioq  =  1  
	  else  
	   	  var.mioq  =  WarehouseItem.MinimumOrderQuantity  
	  end if  
	  if (WarehouseItem.MaximumOrderQuantity  <=  "0") then  
	   	  var.maoq  =  9999999  
	  else  
	   	  var.maoq  =  WarehouseItem.MaximumOrderQuantity  
	  end if  
	  if (WarehouseItem.FixedOrderQuantity  <=  "0") then  
	   	  var.fioq  =  1  
	  else  
	   	  var.fioq  =  WarehouseItem.FixedOrderQuantity  
	  end if  
'  	  if (Warehouse_Item.EconomicOrderQuantity  <=  "0") then  	   |   #  253844.so  
'  	   	  var.ecoq  =  1  
'  	  else  
'  	   	  var.ecoq  =  Warehouse_Item.EconomicOrderQuantity  
'  	  end if  	   	   	   	   	   	   	   |   #  253844.eo  
	  if (WarehouseItem.EconomicOrderQuantity  <=  "0") then  	  '  |   #  253844.sn  
	   	  var.ecoq  =  1  
	  else  
	   	  var.ecoq  =  WarehouseItem.EconomicOrderQuantity  
	  end if  
	   	   	   	   	   	   	  '  |   #  253844.en  
	  var.whwmd210.srpr  =  2  
	  if (WarehouseItem.InventoryValuationMethod)  =  6 then  
	   	  var.whwmd210.srpr  =  1  
	  end if  
	  dump 210  	  '  |   *  whwmd210  -  Warehouse Item Data  
	  dump 215  	  '  |   *  whwmd215  -  Item Inv by Warehouse  
	  dump 216  	  '  |   *  whwmd216  -  Inv by warehouse, item , eff unit
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:S
:QURY:START
select  	  WarehouseItem.*
from 	  WarehouseItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:210
:SCPAC:bc
:SCMOD:tbl
:SFLNO:WarehouseItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Locations
:ICOD:D
:QURY:START
'  *  SL244251.sn  
	  varstr.loc  =  Locations.Location  
	  varlng.fixed.loc  =  2  
	  select  	  LocationByItem.Location  
	  from  	   	  LocationByItem  
	  where  	  LocationByItem.Location  =  varstr.loc  
	  group by  	  LocationByItem.Location  
	  selectdo  
	   	  varlng.fixed.loc  =  1  
	  endselect  
'  |   *  SL244251.en  
	  varstr.cwar  =  Locations.Warehouse  
	  var.whwmd300.inca  =  get.infinite.location(varstr.cwar, varstr.loc)  
	  If Locations.Inbound  =  2 then  	   	   	   	   	   	   	  '  |   #  LN1061.sn  
	   	  var.whwmd300.binb  =  2  
	  else  
	   	  var.whwmd300.binb  =  Locations.BlockedInbound  
	  end if  
	  If Locations.Outbound  =  2 then  
	   	  var.whwmd300.bout  =  2  
	  else  
	   	  var.whwmd300.bout  =  Locations.BlockedOutbound  
	  end if  	   	   	   	   	   	   	   	   	   	  ' |   #  LN1061.en  
	  dump 300 '  |  whwmd300
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Locations
:ICOD:S
:QURY:START
select Locations.*
from Locations
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:300
:SCPAC:bc
:SCMOD:tbl
:SFLNO:Locations
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:405
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackagingItems
:ICOD:D
:QURY:START
	  dump 405
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:405
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackagingItems
:ICOD:S
:QURY:START
select PackagingItems.*
from PackagingItems
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:405
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackagingItems
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:410
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackageDefinitions
:ICOD:D
:QURY:START
	  dump 410
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:410
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackageDefinitions
:ICOD:S
:QURY:START
select PackageDefinitions.*
from PackageDefinitions
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:410
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackageDefinitions
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:420
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackageDefinitionLevels
:ICOD:D
:QURY:START
	  dump 420
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:420
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackageDefinitionLevels
:ICOD:S
:QURY:START
select PackageDefinitionLevels.*
from PackageDefinitionLevels
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:420
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackageDefinitionLevels
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:430
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackageDefinitionsByItem
:ICOD:D
:QURY:START
	  dump 430
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:430
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackageDefinitionsByItem
:ICOD:S
:QURY:START
select PackageDefinitionsByItem.*
from PackageDefinitionsByItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:430
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackageDefinitionsByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:440
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackageDefinitionLevelsByItem
:ICOD:D
:QURY:START
	  dump 440
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:440
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackageDefinitionLevelsByItem
:ICOD:S
:QURY:START
select PackageDefinitionLevelsByItem.*
from PackageDefinitionLevelsByItem
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:440
:SCPAC:bc
:SCMOD:tbl
:SFLNO:PackageDefinitionLevelsByItem
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:530
:SCPAC:bc
:SCMOD:tbl
:SFLNO:HandlingUnits
:ICOD:D
:QURY:START
	  var.whwmd530.flsp  =  HandlingUnits.FloorSpace  
	  if var.whwmd530.flsp  =  "0" then  
	   	  ' Calculate Floorspace if dimensions are present.  
	   	  if HandlingUnits.Length  <>  "0" and HandlingUnits.Width  <>  "0" then  
	   	   	  var.whwmd530.flsp  =  FormatNumber(Cdbl(HandlingUnits.Length)  *  Cdbl(HandlingUnits.Width) )  
	   	  end if  	   
	  end if  
	  var.whwmd530.volu  =  HandlingUnits.Volume  
	  if var.whwmd530.volu  =  "0" then  
	   	  'Calculate Volume if dimensions are present  
	   	  if HandlingUnits.Length  <>  "0" and HandlingUnits.Width  <>  "0" and HandlingUnits.Height  <>  "0" then  
	   	   	  var.whwmd530.volu  =  FormatNumber(Cdbl(HandlingUnits.Length)  *  Cdbl(HandlingUnits.Width)  *  Cdbl(HandlingUnits.Height) )  
	   	  end if  	   
	  end if  	   
	   
	  var.whwmd530.item  =  get.segment.item.code( handlingunits.project, handlingunits.item)  
	  var.whwmd530.clot  =  handlingunits.lot  
	  var.whwmd530.serl  =  handlingunits.serialnumber  
	  var.whwmd530.idat  =  get.utc(handlingunits.inventorydate, "no")  
	  var.whwmd530.qhds  =  handlingunits.quantitystorage  
	  var.whwmd530.unit  =  handlingunits.storageunit  
	  var.whwmd530.qhnd  =  handlingunits.quantityinventory  
	   	   
	  if HandlingUnits.MultiItem  =  1 then  	   
	   	  '  |   *  HU contains multiple types of item. Item specification on this level HU not needed  
	   	  var.whwmd530.item  =  ""  
	   	  var.whwmd530.clot  =  ""  
	   	  var.whwmd530.serl  =  ""  
	   	  var.whwmd530.idat  =  get.utc("","no")  
	   	  var.whwmd530.qhds  =  0  
	   	  var.whwmd530.unit  =  ""  
	   	  var.whwmd530.qhnd  =  0  
	  end if  
	   
	  Dump 1 '  |   #  HandlingUnits  
	  If HandlingUnits.ChildrenPresent  =  2 then  
	   	  Dump 2 '  |   #  HU Stockpoint  
	  end if
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:530
:SCPAC:bc
:SCMOD:tbl
:SFLNO:HandlingUnits
:ICOD:S
:QURY:START
select HandlingUnits.*
from HandlingUnits
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:530
:SCPAC:bc
:SCMOD:tbl
:SFLNO:HandlingUnits
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:532
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AuxiliaryPackaging
:ICOD:D
:QURY:START
	  dump 1 '  |   #  AuxiliaryPackaging
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:532
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AuxiliaryPackaging
:ICOD:S
:QURY:START
select AuxiliaryPackaging.*
from AuxiliaryPackaging
:QURY:END
:TEXT:

:TEXT:END
QRY
:MPRF:14
:VERS:A2LN
:RELE:LN
:CUST:1060
:TCPAC:wh
:TCMOD:wmd
:TFLNO:532
:SCPAC:bc
:SCMOD:tbl
:SFLNO:AuxiliaryPackaging
:ICOD:X
:QURY:START
  
:QURY:END
:TEXT:

:TEXT:END
