@Repository public interface MBHeaderRepository extends org.springframework.data.jpa.repository.JpaRepository<MBHeader,Long>, org.springframework.data.repository.history.RevisionRepository<MBHeader,Long,Integer>
deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAll, flush, getOne, save, saveAndFlushfindAllcount, delete, delete, delete, deleteAll, exists, findOne, saveList<MBHeader> findByWorkOrderEstimate(WorkOrderEstimate workOrderEstimate)
@Query(value="select mbh from MBHeader as mbh where mbh.workOrderEstimate.id =:workOrderEstimateId and mbh.egwStatus.code =:mbStatus and not exists (select distinct cbr from ContractorBillRegister cbr where upper(cbr.billstatus) != :billStatus and cbr = mbh.egBillregister) ") List<MBHeader> findByWorkOrderEstimateId(@Param(value="workOrderEstimateId") Long workOrderEstimateId, @Param(value="mbStatus") String mbStatus, @Param(value="billStatus") String billStatus)
List<MBHeader> findByWorkOrderAndEgwStatus_codeEqualsOrderById(WorkOrder workOrder, String statusCode)
List<MBHeader> findByEgBillregisterAndEgwStatus_codeEquals(ContractorBillRegister contractorBillRegister, String statusCode)
List<MBHeader> findByEgBillregister(ContractorBillRegister contractorBillRegister)
MBHeader findByWorkOrderEstimate_IdAndEgwStatus_codeEquals(Long WorkOrderEstimateId, String statusCode)
@Query(value="select mbh from MBHeader as mbh where mbh.workOrderEstimate.id =:workOrderEstimateId and egwStatus.code not in (:status1, :status2, :status3)") MBHeader findByWorkOrderEstimateAndStatus(@Param(value="workOrderEstimateId") Long workOrderEstimateId, @Param(value="status1") String status1, @Param(value="status2") String status2, @Param(value="status3") String status3)
@Query(value="select distinct(mbh.createdBy) from MBHeader as mbh") List<org.egov.infra.admin.master.entity.User> findMBHeaderCreatedByUsers()
List<MBHeader> findByWorkOrderEstimate_IdAndEgwStatus_codeNotOrderById(Long workOrderEstimateId, String statusCode)
@Query(value="select sum(mbd.quantity) from MBDetails mbd where (mbd.mbHeader.createdDate < (select createdDate from MBHeader where id = :mbHeaderId) or (select count(*) from MBHeader where id = :mbHeaderId) = 0 ) and mbd.mbHeader.egwStatus.code != :status group by mbd.workOrderActivity having mbd.workOrderActivity.id = :woActivityId") Double getPreviousCumulativeQuantity(@Param(value="mbHeaderId") Long mbHeaderId, @Param(value="status") String status, @Param(value="woActivityId") Long woActivityId)
@Query(value="select sum(mbAmount) from MBHeader where id != :mbHeaderId and egwStatus.code != :statusCode and workOrderEstimate.id = :workOrderEstimateId") Double getTotalMBAmountOfMBs(@Param(value="mbHeaderId") Long mbHeaderId, @Param(value="workOrderEstimateId") Long workOrderEstimateId, @Param(value="statusCode") String statusCode)
@Query(value="select distinct(mb.workOrderEstimate.workOrder.workOrderNumber) from MBHeader as mb where upper(mb.workOrderEstimate.workOrder.workOrderNumber) like upper(:code) and mb.egwStatus.code = :status") List<String> findLoaNumbersToCancelMB(@Param(value="code") String code, @Param(value="status") String status)
@Query(value="select distinct(mb.workOrderEstimate.workOrder.contractor.name) from MBHeader as mb where upper(mb.workOrderEstimate.workOrder.contractor.name) like upper(:code) or upper(mb.workOrderEstimate.workOrder.contractor.code) like upper(:code) and mb.egwStatus.code = :status") List<String> findContractorsToSearchMBToCancel(@Param(value="code") String code, @Param(value="status") String status)
@Query(value="select distinct(mb.workOrderEstimate.estimate.projectCode.code) from MBHeader as mb where upper(mb.workOrderEstimate.estimate.projectCode.code) like upper(:code) and mb.egwStatus.code = :status") List<String> findWorkIdentificationNumbersToCancelMB(@Param(value="code") String code, @Param(value="status") String status)
@Query(value="select mbh from MBHeader as mbh where createdDate = (select max(mb.createdDate) from MBHeader as mb where mb.workOrderEstimate.id = :workOrderEstimateId and mb.egwStatus.code != :statusCode)") MBHeader findLatestMBHeaderToValidateMB(@Param(value="workOrderEstimateId") Long workOrderEstimateId, @Param(value="statusCode") String statusCode)
@Query(value="select mbh from MBHeader mbh where mbh.workOrderEstimate.id = :woeId and (mbh.createdDate < (select createdDate from MBHeader where id = :mbHeaderId and mbh.egwStatus.code != :status) or (select count(*) from MBHeader where id = :mbHeaderId) = 0) order by mbh.id") List<MBHeader> getPreviousMBHeaders(@Param(value="mbHeaderId") Long mbHeaderId, @Param(value="woeId") Long woeId, @Param(value="status") String status)
@Query(value="select mbh from MBHeader as mbh where createdDate = (select max(mb.createdDate) from MBHeader as mb where mb.workOrderEstimate.id = :workOrderEstimateId and mbDate <= :billDate and mb.egwStatus.code = :approvedStatusCode and not exists (select cbr from ContractorBillRegister cbr where cbr.status.code != :cancelStatusCode and cbr = mb.egBillregister))") MBHeader findLatestMBHeaderToValidateBillDate(@Param(value="workOrderEstimateId") Long workOrderEstimateId, @Param(value="billDate") Date billDate, @Param(value="approvedStatusCode") String approvedStatusCode, @Param(value="cancelStatusCode") String cancelStatusCode)
@Query(value="select mb from MBHeader as mb where mb.workOrderEstimate.id = :workOrderEstimateId and mbDate <= :billDate and mb.egwStatus.code = :approvedStatusCode and not exists (select cbr from ContractorBillRegister cbr where cbr.status.code != :cancelStatusCode and cbr = mb.egBillregister))") List<MBHeader> findMBHeaderBasedOnbillDate(@Param(value="workOrderEstimateId") Long workOrderEstimateId, @Param(value="billDate") Date billDate, @Param(value="approvedStatusCode") String approvedStatusCode, @Param(value="cancelStatusCode") String cancelStatusCode)
@Query(value="select sum(mbms.quantity) from MBMeasurementSheet mbms where (mbms.mbDetails.mbHeader.createdDate < (select createdDate from MBHeader where id = :mbHeaderId) or (select count(*) from MBHeader where id = :mbHeaderId) = 0 ) and mbms.mbDetails.mbHeader.egwStatus.code != :status group by mbms.woMeasurementSheet having mbms.woMeasurementSheet.id = :woMeasurementSheetId") Double getMeasurementsPreviousCumulativeQuantity(@Param(value="mbHeaderId") Long mbHeaderId, @Param(value="status") String status, @Param(value="woMeasurementSheetId") Long woMeasurementSheetId)
@Query(value="select mbh from MBHeader mbh where mbh.workOrderEstimate.id = :workOrderEstimateId and mbh.egBillregister.id < :contractorBillId ") List<MBHeader> findMBHeadersTillDate(@Param(value="contractorBillId") Long contractorBillId, @Param(value="workOrderEstimateId") Long workOrderEstimateId)
@Query(value="select mbh from MBHeader mbh where exists (select mbd.mbHeader from MBDetails mbd where mbh = mbd.mbHeader and mbd.workOrderActivity.workOrderEstimate.estimate.id =:abstractEstimateId and mbd.workOrderActivity.workOrderEstimate.id =:workOrderEstimateId and mbd.mbHeader.egwStatus.code != :mbStatus and exists (select a from Activity a where a.abstractEstimate.id =:revisionEstimateId and a.abstractEstimate.parent = mbd.workOrderActivity.workOrderEstimate.estimate and a.abstractEstimate.parent.id =:abstractEstimateId and a.revisionType in(:nonTenderderRevisionType,:lumpSumRevisionType))) ") List<MBHeader> findMBHeadersForRevisionEstimate(@Param(value="abstractEstimateId") Long abstractEstimateId, @Param(value="revisionEstimateId") Long revisionEstimateId, @Param(value="workOrderEstimateId") Long workOrderEstimateId, @Param(value="nonTenderderRevisionType") RevisionType nonTenderderRevisionType, @Param(value="lumpSumRevisionType") RevisionType lumpSumRevisionType, @Param(value="mbStatus") String mbStatus)
Copyright © 2015–2016 eGovernments Foundation. All rights reserved.