private async Task <CheckSummary> CheckCustomerByType(string apiType, ICustomerChecksInfo customer, ISpiderCheckResult currentResult) { if (!customer.GetIsCheckRequired(apiType)) { return(CheckSummary.Empty); } var clientId = customer.CustomerId; var previousResultId = customer.GetLatestCheckId(apiType); var previousResult = await _spiderCheckResultRepository.GetAsync(clientId, previousResultId); var diff = _diffService.ComputeDiff(apiType, currentResult, previousResult); var summary = CheckSummary.FromDiff(diff); if (summary.IsSuspected) { var document = await _spiderCheckProcessingService.UploadSpiderCheck(clientId, apiType, UploadRequest); await _spiderDocumentInfoRepository.AddOrUpdateAsync(new SpiderDocumentInfo { CustomerId = clientId, DocumentId = document.DocumentId, CheckDiff = Mapper.Map <SpiderCheckResultDiff>(diff), CurrentCheckId = currentResult.ResultId, PreviousCheckId = previousResultId }); await _customerChecksInfoRepository.UpdateCheckStatesAsync(clientId, apiType, false); } await _customerChecksInfoRepository.UpdateLatestCheckIdAsync(clientId, apiType, currentResult.ResultId); return(summary); }
public virtual IEnumerable ProcessPayment(PXAdapter adapter) { if (this.Documents.Current != null && this.Filter.Current != null) { CheckSummary res = this.Documents.Current; DocFilter currentFilter = this.Filter.Current; APPrintChecks graph = PXGraph.CreateInstance <APPrintChecks>(); PrintChecksFilter paymentFilter = graph.Filter.Current; paymentFilter.PayAccountID = res.PayAccountID; paymentFilter.PayTypeID = res.PayTypeID; graph.Filter.Update(paymentFilter); throw new PXRedirectRequiredException(graph, "ProcessPayment"); } return(Filter.Select()); }
private static GlobalCheckInfo CalcClientCheckInfo(CheckSummary pep, CheckSummary crime, CheckSummary sanction) { return(new GlobalCheckInfo { PepSuspects = pep.IsSuspected.ToOneOrZero(), CrimeSuspects = crime.IsSuspected.ToOneOrZero(), SanctionSuspects = sanction.IsSuspected.ToOneOrZero(), SpiderChecks = 1, TotalClients = 1, AddedProfiles = pep.AddedProfiles + crime.AddedProfiles + sanction.AddedProfiles, ChangedProfiles = pep.ChangedProfiles + crime.ChangedProfiles + sanction.ChangedProfiles, RemovedProfiles = pep.RemovedProfiles + crime.RemovedProfiles + sanction.RemovedProfiles }); }
protected override DataRow GetGridRow(object obj) { if (facade == null) { facade = new WarehouseFacade(base.DataProvider); } DataRow row = this.DtSource.NewRow(); CheckSummary s = (CheckSummary)obj; row["STORAGECODE"] = s.StorageCode; row["CHECKCOUNT"] = s.CHECKNOTOTAL; if (s.TOTAL > 0) { row["PASSREAT"] = Math.Round((double)s.PASSCOUNT / s.TOTAL, 2) * 100 + "%"; } else { row["PASSREAT"] = string.Empty; } return(row); }
protected static void Aggregate(CheckSummary aRes, APPaymentExt aSrc, DateTime?aPayDate) { aRes.DocBal += aSrc.OrigDocAmt; aRes.CuryDocBal += aSrc.CuryOrigDocAmt; aRes.DocCount++; aRes.PayDate = aPayDate; if (aSrc.DocDate < aPayDate) { aRes.OverdueDocCount++; aRes.OverdueDocBal += aSrc.OrigDocAmt; aRes.OverdueCuryDocBal += aSrc.CuryOrigDocAmt; } if (aRes.MaxPayDate == null || aSrc.DocDate > aRes.MaxPayDate) { aRes.MaxPayDate = aSrc.DocDate; } if (aRes.MinPayDate == null || aSrc.DocDate < aRes.MinPayDate) { aRes.MinPayDate = aSrc.DocDate; } }
public virtual IEnumerable documents() { DocFilter filter = Filter.Current; Dictionary <CashAcctKey, CheckSummary> result = new Dictionary <CashAcctKey, CheckSummary>(); if (filter == null && !filter.PayDate.HasValue) { return(result.Values); } PXSelectBase <APPaymentExt> sel = new PXSelectJoin <APPaymentExt, InnerJoin <CashAccount, On <CashAccount.cashAccountID, Equal <APPaymentExt.cashAccountID> >, InnerJoin <Vendor, On <Vendor.bAccountID, Equal <APPayment.vendorID> >, InnerJoin <PaymentMethod, On <PaymentMethod.paymentMethodID, Equal <APPaymentExt.paymentMethodID> >, LeftJoin <CABatchDetail, On <CABatchDetail.origModule, Equal <GL.BatchModule.moduleAP>, And <CABatchDetail.origDocType, Equal <APPayment.docType>, And <CABatchDetail.origRefNbr, Equal <APPayment.refNbr> > > > > > > >, Where <APPaymentExt.released, Equal <boolFalse>, And <APPayment.docType, NotEqual <APDocType.prepayment>, And <APPayment.docType, NotEqual <APDocType.refund>, And <APPaymentExt.openDoc, Equal <boolTrue>, And2 <Match <Vendor, Current <AccessInfo.userName> >, And <Where2 <Where <PaymentMethod.aPCreateBatchPayment, Equal <True>, And <CABatchDetail.batchNbr, IsNull> >, Or <Where <PaymentMethod.aPCreateBatchPayment, Equal <False>, And <PaymentMethod.aPPrintChecks, Equal <boolTrue>, And <APPayment.printed, Equal <boolFalse> > > > > > > > > > > >, OrderBy < Asc <APPaymentExt.docType, Asc <APPaymentExt.refNbr> > > >(this); if (filter.PayDate != null) { sel.WhereAnd <Where <APPaymentExt.docDate, LessEqual <Current <DocFilter.payDate> > > >(); } if (filter.PayAccountID != null) { sel.WhereAnd <Where <APPaymentExt.cashAccountID, Equal <Current <DocFilter.payAccountID> > > >(); } if (filter.PayTypeID != null) { sel.WhereAnd <Where <APPaymentExt.paymentMethodID, Equal <Current <DocFilter.payTypeID> > > >(); } APPaymentKey lastInvoice = null; foreach (PXResult <APPaymentExt, CashAccount, Vendor, PaymentMethod, CABatchDetail> it in sel.Select()) { APPaymentExt inv = (APPaymentExt)it; CashAccount acct = (CashAccount)it; APPaymentKey invNbr = new APPaymentKey(inv.DocType, inv.RefNbr); if (lastInvoice != null && lastInvoice.CompareTo(invNbr) == 0) { continue; //Skip multiple entries for invoice } //inv.DocCount = it.RowCount; lastInvoice = invNbr; CashAcctKey key = new CashAcctKey(inv.CashAccountID.Value, inv.PaymentMethodID); CheckSummary res = null; if (!result.ContainsKey(key)) { res = new CheckSummary(); res.PayAccountID = inv.CashAccountID; res.PayTypeID = inv.PaymentMethodID; res.CuryID = acct.CuryID; res.CuryInfoID = inv.CuryInfoID; result[key] = res; } else { res = result[key]; } Aggregate(res, inv, filter.PayDate); } return(result.Values); }