Open the attached script against your database.


Change the value from @contract_id_change_it_here!! to whatever Contract Id you want to test on


Execute the script.


Open the attached XML and attach it to a new ticket.


Include specific details of the problems you are having.


eg


Task 123 is being split too many times.

Auto Tasks are being created for this PO.

Task 456 is being removed but it should stay.


etc.


select idContract, sgContractNo,cdSchedulingStatus , cdcontractstatus,bStdActive,cdCategory,cdJobType,fkidTemplate,
(select idWorkItem, w.sgItemName, cdTaskStatus, fkidTemplateItem, cdSupplierStatus, cdSupplierLocked, w.inOrder, dtDatePlanned, w.fkidSupplier,w.bstdactive, w.dcDurnScaled as dcScaledDuration, t.dcDuration as dcInitialDuration, w.sgWBSCode
from tblworkitems w
left join tblTemplateItems t on w.fkidTemplateItem = t.idTemplateItem 
where fkidcontract = idContract
order by inOrder 
FOR XML RAW ('WorkItem'), ROOT ('WorkItems'), TYPE),
(select *
from tblPOWorkItemLinks 
where fkidWorkItem in (select idworkitem from tblworkitems where fkidContract = idContract)
FOR XML RAW ('POWorkItemLink'), ROOT ('POWorkItemLinks'), TYPE),

(select *
from tblWorkItemHistories  
where fkidWorkItem in (select idworkitem from tblworkitems where fkidContract = idContract)
FOR XML RAW ('WorkItemHistory'), ROOT ('WorkItemHistories'), TYPE),

(select *
from tblWorkItemsLogs  
where fkidWorkItem in (select idworkitem from tblworkitems where fkidContract = idContract)
FOR XML RAW ('WorkItemLog'), ROOT ('WorkItemLogs'), TYPE),


(select *
from tblMessages   
where fkidWorkItem in (select idworkitem from tblworkitems where fkidContract = idContract)
FOR XML RAW ('Message'), ROOT ('Messages'), TYPE),

(select *
from tblRequisitions   
where fkidContract = idContract
FOR XML RAW ('Requisition'), ROOT ('Requisitions'), TYPE),


(select *
from tblPOTemplateMatches 
where fkidtemplateitem in (select idtemplateitem from tblTemplateItems where tblTemplateItems.fkidTemplate = tblContracts.fkidTemplate)
FOR XML RAW ('POTemplateMatch'), ROOT ('POTemplateMatches'), TYPE),
(SELECT     tblPOHeaders.idPOHeader, tblPOHeaders.fkidContract, tblPOHeaders.fkidSupplier, tblPOHeaders.fkidRequisition, tblPOHeaders.sgPOReference, tblPOHeaders.sgRequisitionReference, 
                      tblsuppliers.sgStdExtRef as sgSupplierExtRef, tblPOHeaders.sgContactPerson, tblPOHeaders.cdContactMethod, tblPOHeaders.sgContactBy, tblPOHeaders.dtPODate, tblPOHeaders.cdStatus, 
                      tblPOHeaders.snApprovedPercent, tblPOHeaders.crTotalPrice, tblPOHeaders.crTotalTax, tblPOHeaders.bPartialPayment, tblPOHeaders.sgStdExtRef, tblPOHeaders.inStdCustomOrder, 
                      tblPOHeaders.bStdActive, tblPOHeaders.fkidStdCreatedBy, tblPOHeaders.dtStdCreatedOn, tblPOHeaders.fkidStdLastModifiedBy, tblPOHeaders.dtStdLastModifiedOn,  tblPOHeaders.fkidDocument,
            fkidRequisition as sgPOReqRef
,
(select * from tblPOLines 
where fkidPOHeader = idpoheader
FOR XML RAW ('POLine'), TYPE)
FROM         tblPOHeaders LEFT OUTER JOIN
                      tblSuppliers ON tblPOHeaders.fkidSupplier = tblSuppliers.idSupplier

where fkidContract = idcontract
FOR XML RAW ('POHeader'), ROOT ('POHeaders'), TYPE),
(select *,fkidRequisition as sgPOReqRef,
(select * from tblInterfacePOLines  
where tblInterfacePOHeaders.sgPOReference = tblInterfacePOLines.sgPOReference 
FOR XML RAW ('InterfacePOLine'), TYPE)
from tblInterfacePOHeaders 
where tblInterfacePOHeaders.sgLookupContract = tblcontracts.sgContractNo 
FOR XML RAW ('InterfacePOHeader'), ROOT ('InterfacePOHeaders'), TYPE)
from tblContracts
where idContract = @contract_id_change_it_here!!
FOR XML RAW ('Contract'), ROOT ('POTestData'), TYPE