select project0_.C_Project_ID as C1_548_, project0_.EM_SAFE_Producedhours as EM2_548_, project0_.AD_Client_ID as AD3_548_, project0_.AD_Org_ID as AD4_548_, project0_.IsActive as IsActive548_, project0_.Created as Created548_, project0_.CreatedBy as CreatedBy548_, project0_.Updated as Updated548_, project0_.UpdatedBy as UpdatedBy548_, project0_.Value as Value548_, project0_.Name as Name548_, project0_.Description as Descrip12_548_, project0_.Note as Note548_, project0_.IsSummary as IsSummary548_, project0_.AD_User_ID as AD15_548_, project0_.C_BPartner_ID as C16_548_, project0_.C_BPartner_Location_ID as C17_548_, project0_.POReference as PORefer18_548_, project0_.C_PaymentTerm_ID as C19_548_, project0_.C_Currency_ID as C20_548_, project0_.Createtemppricelist as Createt21_548_, project0_.EM_SAFE_Overrun as EM22_548_, project0_.M_PriceList_Version_ID as M23_548_, project0_.C_Campaign_ID as C24_548_, project0_.IsCommitment as IsCommi25_548_, project0_.PlannedAmt as PlannedAmt548_, project0_.PlannedQty as PlannedQty548_, project0_.PlannedMarginAmt as Planned28_548_, project0_.CommittedAmt as Committ29_548_, project0_.DateContract as DateCon30_548_, project0_.DateFinish as DateFinish548_, project0_.GenerateTo as GenerateTo548_, project0_.EM_SAFE_Updateindicators as EM33_548_, project0_.Processed as Processed548_, project0_.SalesRep_ID as SalesRep35_548_, project0_.CopyFrom as CopyFrom548_, project0_.C_ProjectType_ID as C37_548_, project0_.CommittedQty as Committ38_548_, project0_.InvoicedAmt as Invoice39_548_, project0_.InvoicedQty as Invoice40_548_, project0_.ProjectBalanceAmt as Project41_548_, project0_.C_Phase_ID as C42_548_, project0_.C_ProjectPhase_ID as C43_548_, project0_.EM_SAFE_Updated as EM44_548_, project0_.IsCommitCeiling as IsCommi45_548_, project0_.M_Warehouse_ID as M46_548_, project0_.ProjectCategory as Project47_548_, project0_.Processing as Processing548_, project0_.Publicprivate as Publicp49_548_, project0_.Projectstatus as Project50_548_, project0_.Projectkind as Project51_548_, project0_.BillTo_ID as BillTo52_548_, project0_.Projectphase as Project53_548_, project0_.GenerateOrder as Generat54_548_, project0_.ChangeProjectStatus as ChangeP55_548_, project0_.EM_SAFE_CostProvisionIncluded as EM56_548_, project0_.C_Location_ID as C57_548_, project0_.M_PriceList_ID as M58_548_, project0_.PaymentRule as Payment59_548_, project0_.Invoice_ToProject as Invoice60_548_, project0_.PlannedPOAmt as Planned61_548_, project0_.LastPlannedProposalDate as LastPla62_548_, project0_.Document_Copies as Document63_548_, project0_.AccountNo as AccountNo548_, project0_.Expexpenses as Expexpe65_548_, project0_.EM_SAFE_ExpProvisionIncluded as EM66_548_, project0_.Expmargin as Expmargin548_, project0_.Expreinvoicing as Exprein68_548_, project0_.Responsible_ID as Respons69_548_, project0_.Servcost as Servcost548_, project0_.Servmargin as Servmargin548_, project0_.Servrevenue as Servrev72_548_, project0_.Setprojecttype as Setproj73_548_, project0_.Startdate as Startdate548_, project0_.Servsercost as Servser75_548_, project0_.Servoutcost as Servout76_548_, project0_.EM_SAFE_ExpectedTotalBalance as EM77_548_, project0_.FIN_Paymentmethod_ID as FIN78_548_, project0_.EM_Obces_User1_ID as EM79_548_, project0_.EM_Prhr_Iscorporate as EM80_548_, project0_.EM_Obces_C_Country_ID as EM81_548_, project0_.EM_Obces_Descriptionlong as EM82_548_, project0_.EM_Obces_Descriptionshort as EM83_548_, project0_.EM_SAFE_ExpectedTotalMargin as EM84_548_, project0_.EM_SAFE_RealServRevenue as EM85_548_, project0_.EM_Obces_Margen_Bruto as EM86_548_, project0_.EM_Obces_Otros_Costreal as EM87_548_, project0_.EM_Obces_Margen_Brutoreal as EM88_548_, project0_.EM_SAFE_RealServSerCost as EM89_548_, project0_.EM_SAFE_Expenses as EM90_548_, project0_.EM_SAFE_RealServOutCost as EM91_548_, project0_.EM_SAFE_RealServCost as EM92_548_, project0_.EM_SAFE_RealServMargin as EM93_548_, project0_.EM_SAFE_RealExpenses as EM94_548_, project0_.EM_SAFE_RealExpReinvoicing as EM95_548_, project0_.EM_SAFE_RealExpMargin as EM96_548_, project0_.EM_SAFE_RealTotalBalance as EM97_548_, project0_.EM_SAFE_RealTotalMargin as EM98_548_, (select (p.EM_SAFE_RealServRevenue+p.EM_SAFE_RealExpReinvoicing) from c_project p where p.c_project_id=project0_.c_project_id) as formula9_, (select sum(project0_.total), project0_.c_project_id from ( select project0_.EM_SAFE_RealExpenses as project0_total, project0_.c_project_id from c_project union select sum(il.LineNetAmt) as project0_total, p.c_project_id from c_project p left join c_invoice i on p.c_project_id=i.c_project_id left join c_invoiceline il on i.c_invoice_id=il.c_invoice_id where i.issotrx='N' and il.EM_Obces_Reinvoicing='Y' group by p.c_project_id union select sum(il.LineNetAmt) as project0_total, p.c_project_id from c_project p left join c_invoiceline il on p.c_project_id=il.c_project_id left join c_invoice i on i.c_invoice_id=il.c_invoice_id where i.issotrx='N' and il.EM_Obces_Reinvoicing='Y' group by p.c_project_id union select sum(ac.amt) as project0_total, p.c_project_id from c_project p left join c_invoiceline_acctdimension ac on p.c_project_id=ac.c_project_id left join c_invoiceline il on ac.c_invoiceline_id=il.c_invoiceline_id left join c_invoice i on i.c_invoice_id=il.c_invoice_id where i.issotrx='N' and il.EM_Obces_Reinvoicing='Y' group by p.c_project_id ) project0_A where a.c_project_id=project0_.c_project_id group by a.C_project_id ) as formula10_ from C_Project project0_ where ( project0_.EM_Obces_User1_ID in ( select aduser1_.EM_Obces_User1_ID from AD_User aduser1_ where aduser1_.AD_User_ID=? ) or ( select aduser2_.EM_Obces_User1_ID from AD_User aduser2_ where aduser2_.AD_User_ID=? ) is null ) and project0_.ProjectCategory='S' and ( project0_.AD_Org_ID in ( '96F5D0A592A34496AB4A7862B91FFE11' , '0' , '6035E379B55E457C9D78F48ED529F9EC' , '1C9B62955AB541BF968E0BA64D0F0225' , '412B8904D686467FB1A4E10345737510' , 'EAD34D54D4414F0F9532FEE5BDAF52AF' , '960E4B9460944032BE1BA8BB0CA6F2F7' , '2C1C7BE6C26C430EB4B72C3E643ACA17' ) ) and ( project0_.AD_Client_ID in ( '1C12F827C90E4AC5B4D49B578616A505' , '0' ) ) order by project0_.EM_SAFE_RealServOutCost, project0_.C_Project_ID limit ?