public ReconciliationEgmTotals GetEgmAmounts(string jobNumber)
        {
            SapphireRepository sapphireRepository   = new SapphireRepository();
            DataTable          sapphireEgmJobTotals = sapphireRepository.GetSapphireRecords("JobCstActs_EGM", jobNumber);

            if (!(sapphireEgmJobTotals is null))
            {
                // Get pervasive egm totals by Job
                PurchaseOrderHeaderRepository purchaseOrderHeaderRepository = new PurchaseOrderHeaderRepository();
                DataTable pervasiveEgmJobTotals = purchaseOrderHeaderRepository.GetPervasiveRecords("JobCstActs_EGM", jobNumber);

                if (!(pervasiveEgmJobTotals is null) && pervasiveEgmJobTotals.AsEnumerable().Any())
                {
                    var egmJobTotalsAudit = AuditEgmJobTotals(sapphireEgmJobTotals, pervasiveEgmJobTotals);

                    ReconciliationEgmTotals egmTotals = new ReconciliationEgmTotals();
                    egmTotals.JobNumber            = jobNumber;
                    egmTotals.SapphireEgmTotal     = Convert.ToDecimal(egmJobTotalsAudit.ToList()[0].SapphireEgmTotal);
                    egmTotals.PervasiveEgmTotal    = Convert.ToDecimal(egmJobTotalsAudit.ToList()[0].PervasiveEgmTotal);
                    egmTotals.EstimateApprovalDate = egmJobTotalsAudit.ToList()[0].EstimateApprovalDate;

                    return(egmTotals);
                }
            }

            return(null);
        }
        public IEnumerable <JobCostSummary> JobData(int homeRID)
        {
            JobCostActivityService  _jobCostActivityService = new JobCostActivityService();
            ReconciliationEgmTotals egmTotals = _jobCostActivityService.GetEgmAmountsByHomeRID(homeRID);

            return(Enumerable.Range(1, 1).Select(i => new JobCostSummary
            {
                id = i,
                jobNumber = egmTotals.JobNumber,
                estimateApprovalDate = egmTotals.EstimateApprovalDate,
                sapphireEgmTotal = Convert.ToDecimal(egmTotals.SapphireEgmTotal.ToString()).ToString("0.00"),
                pervasiveEgmTotal = Convert.ToDecimal(egmTotals.PervasiveEgmTotal.ToString()).ToString("0.00")
            }));
        }
Exemple #3
0
        private void ReconcileJobCstActRecordsAndEGMAmounts()
        {
            string jobNumber = RequestJobNumberInput();

            ReconciliationEgmTotals egmTotals = _jobCostActivityService.GetEgmAmountsByJobNumber(jobNumber);

            //_jobCostActivityService.WriteEgmTotals(egmTotals);

            if (!_jobCostActivityService.EgmTotalsMatch(egmTotals))
            {
                // Confirm update
                if (Console.ReadLine().ToUpper() == "Y")
                {
                    string company = _companyRepository.GetCompanyByJob(jobNumber);
                    _jobCostActivityService.ReconcileJobCstActRecordsAndEGMAmounts(jobNumber, company);

                    _jobCostActivityService.ValidateEgmAmountsByJobNumber(jobNumber);
                }
            }

            // Loop through process again, allowing entry of new job number
            ReconcileMissingJobCostActivityRecords();
        }
 public JObject FormatAsJson(ReconciliationEgmTotals objectToFormat)
 {
     return(JObject.FromObject(objectToFormat));
 }