public virtual List <ContractInvoiceLine> GetContractPeriodLines(ContractPeriodToPost contractPeriodToPostRow) { var resultSet = PXSelectJoin <FSContractPeriodDet, InnerJoin <FSContractPeriod, On < FSContractPeriod.contractPeriodID, Equal <FSContractPeriodDet.contractPeriodID> >, InnerJoin <FSServiceContract, On < FSServiceContract.serviceContractID, Equal <FSContractPeriod.serviceContractID> >, InnerJoin <FSBranchLocation, On < FSBranchLocation.branchLocationID, Equal <FSServiceContract.branchLocationID> > > > >, Where < FSServiceContract.serviceContractID, Equal <Required <FSServiceContract.serviceContractID> >, And <FSContractPeriod.contractPeriodID, Equal <Required <FSContractPeriod.contractPeriodID> > > > > .Select(this, contractPeriodToPostRow.ServiceContractID, contractPeriodToPostRow.ContractPeriodID); var docLines = new List <ContractInvoiceLine>(); foreach (PXResult <FSContractPeriodDet, FSContractPeriod, FSServiceContract, FSBranchLocation> result in resultSet) { docLines.Add(new ContractInvoiceLine(result)); } return(docLines); }
protected virtual IEnumerable contracts() { int?currentContractPeriodID = -1; var results = PXSelectJoin <ContractPeriodToPost, LeftJoin <FSServiceOrder, On <FSServiceOrder.billServiceContractID, Equal <ContractPeriodToPost.serviceContractID>, And <FSServiceOrder.billContractPeriodID, Equal <ContractPeriodToPost.contractPeriodID>, And <FSServiceOrder.allowInvoice, Equal <False>, And <FSServiceOrder.status, Equal <FSServiceOrder.status.Open> > > > >, LeftJoin <FSAppointment, On <FSAppointment.billServiceContractID, Equal <ContractPeriodToPost.serviceContractID>, And <FSAppointment.billContractPeriodID, Equal <ContractPeriodToPost.contractPeriodID>, And <FSAppointment.status, NotEqual <FSAppointment.status.Closed>, And <FSAppointment.status, NotEqual <FSAppointment.status.Canceled> > > > >, InnerJoinSingleTable <Customer, On <Customer.bAccountID, Equal <ContractPeriodToPost.billCustomerID>, And <Match <Customer, Current <AccessInfo.userName> > > > > > >, Where2 < Where <CurrentValue <InvoiceContractPeriodFilter.customerID>, IsNull, Or <ContractPeriodToPost.billCustomerID, Equal <CurrentValue <InvoiceContractPeriodFilter.customerID> > > >, And2 < Where <CurrentValue <InvoiceContractPeriodFilter.upToDate>, IsNull, Or <ContractPeriodToPost.endPeriodDate, LessEqual <CurrentValue <InvoiceContractPeriodFilter.upToDate> > > >, And < Where <CurrentValue <InvoiceContractPeriodFilter.serviceContractID>, IsNull, Or <ContractPeriodToPost.serviceContractID, Equal <CurrentValue <InvoiceContractPeriodFilter.serviceContractID> > > > > > >, OrderBy < Asc <ContractPeriodToPost.serviceContractID, Asc <ContractPeriodToPost.contractPeriodID, Asc <FSServiceOrder.sOID, Asc <FSAppointment.appointmentID> > > > > > .Select(this); foreach (PXResult <ContractPeriodToPost, FSServiceOrder, FSAppointment> it in results) { ContractPeriodToPost contractPeriodToPostRow = (ContractPeriodToPost)it; FSServiceOrder fsServiceOrderRow = (FSServiceOrder)it; FSAppointment fsAppointmentRow = (FSAppointment)it; if (fsServiceOrderRow?.SOID != null || fsAppointmentRow?.AppointmentID != null) { continue; } else { if (currentContractPeriodID != contractPeriodToPostRow.ContractPeriodID) { yield return(new PXResult <ContractPeriodToPost>(it)); } currentContractPeriodID = contractPeriodToPostRow.ContractPeriodID; } } Contracts.Cache.IsDirty = false; Contracts.View.RequestRefresh(); }
public virtual List <ContractInvoiceLine> GetEquipmentInvoiceLines(ContractPeriodToPost contractPeriodToPostRow) { List <ContractInvoiceLine> contractInvoiceLines = new List <ContractInvoiceLine>(); var appointmentDetResultSet = PXSelectJoin <FSAppointmentDet, InnerJoin <FSSODet, On <FSSODet.sODetID, Equal <FSAppointmentDet.sODetID> >, InnerJoin <FSAppointment, On <FSAppointment.srvOrdType, Equal <FSAppointmentDet.srvOrdType>, And <FSAppointment.refNbr, Equal <FSAppointmentDet.refNbr> > > > >, Where < FSAppointment.billServiceContractID, Equal <Required <FSAppointment.billServiceContractID> >, And <FSAppointment.billContractPeriodID, Equal <Required <FSAppointment.billContractPeriodID> >, And <FSAppointmentDet.equipmentAction, NotEqual <FSAppointmentDet.equipmentAction.None>, And <FSAppointmentDet.lineType, NotEqual <FSAppointmentDet.lineType.Comment_Service>, And <FSAppointmentDet.lineType, NotEqual <FSAppointmentDet.lineType.Comment_Part>, And <FSAppointmentDet.lineType, NotEqual <FSAppointmentDet.lineType.Instruction_Part>, And <FSAppointmentDet.lineType, NotEqual <FSAppointmentDet.lineType.Instruction_Service>, And <FSAppointmentDet.status, NotEqual <FSAppointmentDet.status.Canceled>, And <FSAppointmentDet.lineType, NotEqual <ListField_LineType_Pickup_Delivery.Pickup_Delivery>, And <FSAppointmentDet.isPrepaid, Equal <False> > > > > > > > > > > > .Select(this, contractPeriodToPostRow.ServiceContractID, contractPeriodToPostRow.ContractPeriodID); foreach (PXResult <FSAppointmentDet, FSSODet, FSAppointment> result in appointmentDetResultSet) { contractInvoiceLines.Add(new ContractInvoiceLine(result)); } var appointmentInventoryItemResultSet = PXSelectJoin <FSAppointmentInventoryItem, InnerJoin <FSSODet, On <FSSODet.sODetID, Equal <FSAppointmentInventoryItem.sODetID> >, InnerJoin <FSAppointment, On <FSAppointment.srvOrdType, Equal <FSAppointmentInventoryItem.srvOrdType>, And <FSAppointment.refNbr, Equal <FSAppointmentInventoryItem.refNbr> > > > >, Where < FSAppointment.billServiceContractID, Equal <Required <FSAppointment.billServiceContractID> >, And <FSAppointment.billContractPeriodID, Equal <Required <FSAppointment.billContractPeriodID> >, And <FSAppointmentInventoryItem.lineType, Equal <ListField_LineType_Pickup_Delivery.Pickup_Delivery>, And <FSAppointmentInventoryItem.equipmentAction, NotEqual <FSAppointmentDet.equipmentAction.None> > > > > > .Select(this, contractPeriodToPostRow.ServiceContractID, contractPeriodToPostRow.ContractPeriodID); foreach (PXResult <FSAppointmentInventoryItem, FSSODet, FSAppointment> result in appointmentInventoryItemResultSet) { contractInvoiceLines.Add(new ContractInvoiceLine(result)); } var soDetResultSet = PXSelectJoin <FSSODet, InnerJoin <FSServiceOrder, On <FSServiceOrder.srvOrdType, Equal <FSSODet.srvOrdType>, And <FSServiceOrder.refNbr, Equal <FSSODet.refNbr> > > >, Where < FSServiceOrder.billServiceContractID, Equal <Required <FSServiceOrder.billServiceContractID> >, And <FSServiceOrder.billContractPeriodID, Equal <Required <FSServiceOrder.billContractPeriodID> >, And <FSSODet.equipmentAction, NotEqual <FSAppointmentDet.equipmentAction.None>, And <FSSODet.lineType, NotEqual <FSSODet.lineType.Comment_Service>, And <FSSODet.lineType, NotEqual <FSSODet.lineType.Comment_Part>, And <FSSODet.lineType, NotEqual <FSSODet.lineType.Instruction_Part>, And <FSSODet.lineType, NotEqual <FSSODet.lineType.Instruction_Service>, And <FSSODet.status, NotEqual <FSSODet.status.Canceled>, And <FSSODet.isPrepaid, Equal <False> > > > > > > > > > > .Select(this, contractPeriodToPostRow.ServiceContractID, contractPeriodToPostRow.ContractPeriodID); foreach (PXResult <FSSODet, FSServiceOrder> result in soDetResultSet) { contractInvoiceLines.Add(new ContractInvoiceLine(result)); } return(contractInvoiceLines); }