@Repository public interface ContractorBillRegisterRepository extends org.springframework.data.jpa.repository.JpaRepository<ContractorBillRegister,Long>
deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAll, flush, getOne, save, saveAndFlushfindAllContractorBillRegister findByBillnumber(String billNumber)
List<ContractorBillRegister> findByBillnumberContainingIgnoreCase(String billNumber)
@Query(value="select max(billSequenceNumber) from ContractorBillRegister cbr where cbr.workOrderEstimate.estimate.projectCode.code = :workIdentificationNumber") Integer findMaxBillSequenceNumberByWorkOrder(@Param(value="workIdentificationNumber") String workIdentificationNumber)
@Query(value="select distinct(cbr.workOrderEstimate.estimate.projectCode.code) from ContractorBillRegister as cbr where upper(cbr.workOrderEstimate.estimate.projectCode.code) like upper(:code) ") List<String> findWorkIdentificationNumberToSearchContractorBill(@Param(value="code") String code)
@Query(value="select distinct(cbr.workOrderEstimate.workOrder.contractor.name) from ContractorBillRegister as cbr where upper(cbr.workOrderEstimate.workOrder.contractor.name) like upper(:contractorname) or upper(cbr.workOrderEstimate.workOrder.contractor.code) like upper(:contractorname) and cbr.workOrderEstimate.workOrder.egwStatus.code = :workOrderStatus ") List<String> findContractorForContractorBill(@Param(value="contractorname") String contractorname, @Param(value="workOrderStatus") String workOrderStatus)
@Query(value="select sum(cbr.billamount) from ContractorBillRegister as cbr where cbr.workOrderEstimate = :workOrderEstimate and upper(cbr.billstatus) not in (:billStatus)") BigDecimal findSumOfBillAmountByWorkOrderAndStatus(@Param(value="workOrderEstimate") WorkOrderEstimate workOrderEstimate, @Param(value="billStatus") String billStatus)
@Query(value="select sum(cbr.billamount) from ContractorBillRegister as cbr where cbr.workOrderEstimate = :workOrderEstimate and cbr.id != :id and upper(cbr.billstatus) not in (:billStatus)") BigDecimal findSumOfBillAmountByWorkOrderAndStatusAndNotContractorBillRegister(@Param(value="workOrderEstimate") WorkOrderEstimate workOrderEstimate, @Param(value="billStatus") String billStatus, @Param(value="id") Long id)
@Query(value="select distinct(cbr.workOrderEstimate.workOrder.workOrderNumber) from ContractorBillRegister as cbr where upper(cbr.workOrderEstimate.workOrder.workOrderNumber) like upper(:workOrderNumber) and upper(cbr.billstatus) = :status") List<String> findWorkOrderNumbersToCancel(@Param(value="workOrderNumber") String workOrderNumber, @Param(value="status") String status)
@Query(value="select distinct(cbr.workOrderEstimate.estimate.projectCode.code) from ContractorBillRegister as cbr where upper(cbr.workOrderEstimate.estimate.projectCode.code) like upper(:code) and billstatus = :status ") List<String> findWorkIdentificationNumberToSearchContractorBillToCancel(@Param(value="code") String code, @Param(value="status") String status)
@Query(value="select distinct(cbr.billnumber) from ContractorBillRegister as cbr where upper(cbr.billnumber) like upper(:billnumber) and billstatus = :status") List<String> findBillNumberToSearchContractorBillToCancel(@Param(value="billnumber") String billNumber, @Param(value="status") String status)
@Query(value="select distinct(cbr) from ContractorBillRegister as cbr where cbr.workOrderEstimate.workOrder = :workOrder and upper(cbr.billstatus) != :billstatus ") List<ContractorBillRegister> findByWorkOrderAndBillstatusNot(@Param(value="workOrder") WorkOrder workOrder, @Param(value="billstatus") String billstatus)
@Query(value="select distinct(cbr) from ContractorBillRegister as cbr where cbr.workOrderEstimate = :workOrderEstimate and upper(cbr.billstatus) != :status and cbr.billtype = :billtype") ContractorBillRegister findByWorkOrderAndBillTypeAndStatus(@Param(value="workOrderEstimate") WorkOrderEstimate workOrderEstimate, @Param(value="status") String status, @Param(value="billtype") String billtype)
@Query(value="select max(cbr.billdate) from ContractorBillRegister as cbr where upper(cbr.billstatus) = :billstatus and cbr.billtype = :billtype and cbr.workOrderEstimate.id = :workOrderEstimateId and cbr.createdDate < :billCreatedDate") Date getLastPartBillDate(@Param(value="billCreatedDate") Date billCreatedDate, @Param(value="workOrderEstimateId") Long workOrderEstimateId, @Param(value="billstatus") String billstatus, @Param(value="billtype") String billtype)
@Query(value="select COALESCE(sum(billdetail.creditamount),0) as creditAmount,COALESCE(sum(billdetail.debitamount),0) as debitAmount from EgBilldetails billdetail where billdetail.egBillregister.billstatus =:status and billdetail.glcodeid =:glCodeId and exists (select cbr from ContractorBillRegister cbr where billdetail.egBillregister.id = cbr.id and cbr.workOrderEstimate.id =:workOrderEstmateId and cbr.billstatus = :status) and (billdetail.egBillregister.createdDate < (select createdDate from ContractorBillRegister where id = :contractorBillId) or (select count(*) from ContractorBillRegister where id = :contractorBillId) = 0 )") String findSumOfDebitByAccountCodeForWorkOrder(@Param(value="workOrderEstmateId") Long workOrderEstmateId, @Param(value="glCodeId") BigDecimal glCodeId, @Param(value="status") String status, @Param(value="contractorBillId") Long contractorBillId)
@Query(value="select COALESCE(sum(cbr.billamount),0) from ContractorBillRegister as cbr where cbr.workOrderEstimate.id = :workOrderEstimateId and upper(cbr.billstatus) != :status and cbr.billtype = :billtype") Double findSumOfBillAmountByWorkOrderEstimateAndStatusAndBilltype(@Param(value="workOrderEstimateId") Long workOrderEstimateId, @Param(value="status") String status, @Param(value="billtype") String billtype)
@Query(value="select COALESCE(sum(billdetail.creditamount),0) from EgBilldetails billdetail where billdetail.egBillregister.billstatus != :billStatus and billdetail.glcodeid in :coaIds and exists (select cbr from ContractorBillRegister cbr where billdetail.egBillregister.id = cbr.id and cbr.workOrderEstimate.id =:woeId and cbr.billstatus != :billStatus) and (billdetail.egBillregister.createdDate < (select createdDate from ContractorBillRegister where id = :contractorBillId) or (select count(*) from ContractorBillRegister where id = :contractorBillId) = 0 )") Double getAdvanceAdjustedSoFar(@Param(value="woeId") Long woeId, @Param(value="contractorBillId") Long contractorBillId, @Param(value="coaIds") List<BigDecimal> coaIds, @Param(value="billStatus") String billStatus)
@Query(value="select COALESCE(sum(billdetail.creditamount),0) from EgBilldetails billdetail where billdetail.egBillregister.billstatus != :billStatus and billdetail.glcodeid in :coaIds and exists (select cbr from ContractorBillRegister cbr where billdetail.egBillregister.id = cbr.id and cbr.workOrderEstimate.id =:woeId and cbr.billstatus != :billStatus)") Double getTotalAdvanceAdjusted(@Param(value="woeId") Long woeId, @Param(value="coaIds") List<BigDecimal> coaIds, @Param(value="billStatus") String billStatus)
@Query(value="select distinct(billdetail.egBillregister.billnumber) from EgBilldetails billdetail where upper(billdetail.egBillregister.billstatus) != :billStatus and upper(billdetail.egBillregister.status.code) !=:billStatus and billdetail.creditamount > 0 and billdetail.glcodeid in (:glcodeId) and exists (select cbr from ContractorBillRegister cbr where billdetail.egBillregister.id = cbr.id and cbr.workOrderEstimate.id =:workOrderEstimateId)") List<String> findBillNumberToCancelAdvanceReqisition(@Param(value="workOrderEstimateId") Long workOrderEstimateId, @Param(value="billStatus") String billStatus, @Param(value="glcodeId") BigDecimal glcodeId)
Copyright © 2015–2017 eGovernments Foundation. All rights reserved.