Пример #1
0
        public static IECLRecordVoucherInfo GetMatchingECLRecord(VoucherInformation voucher, IEnumerable<IECLRecord> ECLItemsResult)
        {
            var ICLRecord = ECLItemsResult.Where
                (eclItems => eclItems.Amount == voucher.voucher.amount.PadLeft(10, '0') &&
                             eclItems.ChequeSerialNumber == voucher.voucher.auxDom.PadLeft(9, '0') &&
                             eclItems.DrawerAccountNumber == voucher.voucher.accountNumber.PadLeft(10, ' ') &&
                             eclItems.LedgerBSBCode == voucher.voucher.bsbNumber).ToArray<IECLRecord>();

            if (ICLRecord.Count<IECLRecord>() == 0)
            {
                Log.Error("[Get]:[UpdateVoucherProcessInformation] NO IECLRecord found.");
                throw new InvalidOperationException();
            }

            if (ICLRecord.Count<IECLRecord>() >= 1)
            {
                if (ICLRecord.Count<IECLRecord>() > 1)
                {
                    Log.Warning(String.Format("[Get]:[UpdateVoucherProcessInformation] Voucher_{0}_{1}_{2}_{3}.JSON",
                        voucher.voucher.processingDate.ToString("ddMMyyyy"),
                        voucher.voucher.documentReferenceNumber,
                        voucher.voucherBatch.scannedBatchNumber,
                        voucher.voucherProcess.transactionLinkNumber));
                    Log.Warning("[Get]:[UpdateVoucherProcessInformation] More than one (1) IECLRecord found, will use the first one.");
                }
                else
                {
                    Log.Information("[Get]:[UpdateVoucherProcessInformation] An exact IECLRecord found.");
                }
                
                APPresentmentTypeEnum exchangeMode = APPresentmentTypeEnum.E;
                var PresentmentTypeEnum = Enum.TryParse<APPresentmentTypeEnum>(ICLRecord.FirstOrDefault().ExchangeModeCode, out exchangeMode);
                if (PresentmentTypeEnum)
                {
                    voucher.voucherProcess.apPresentmentType = exchangeMode;
                }
                else
                {
                    Log.Error("[Get]:[GetCorrespondingECLRecord] there was an error in parsing enum value of {@enumValue}", ICLRecord.FirstOrDefault().ExchangeModeCode);
                    throw new InvalidOperationException();
                }
            }

            var matchedECLVoucher = new ECLRecordVoucherInfo();
            matchedECLVoucher.MatchedECLRecord = ICLRecord.FirstOrDefault();
            matchedECLVoucher.Voucher = voucher;

            return matchedECLVoucher;
        }
Пример #2
0
        public static VoucherInfoBatch UnMatchVouchers(iVoucherInfoBatch voucherInfoBatch, VoucherInformation[] MatchedVouchers)
        {
            var unMatchedVoucher = new VoucherInfoBatch();

            if (voucherInfoBatch.VoucherInformation != null)
            {
                var vouchers = voucherInfoBatch.VoucherInformation.Select(a => a.Voucher).ToArray<VoucherInformation>();
                unMatchedVoucher.JobIdentifier = voucherInfoBatch.JobIdentifier;

                if (vouchers.Length != 0)
                {
                    var newQuery = vouchers.Except(MatchedVouchers).Select(a => new ECLRecordVoucherInfo { Voucher = a })
                                                                    .ToList<IECLRecordVoucherInfo>();

                    unMatchedVoucher.VoucherInformation = newQuery;
                }
            }

            return unMatchedVoucher;
        }
        private VoucherInformation GetTestData_VoucherInfo()
        {
            var voucher = new Voucher
            {
                documentReferenceNumber = "04114",
                bsbNumber = "082401",
                auxDom = string.Empty,
                accountNumber = "813208132",
                amount = "419.38",
                documentType = DocumentTypeEnum.Dr,
                transactionCode = "01",
                processingDate = new DateTime(2015, 01, 01)
            };

            var voucherProcess = new VoucherProcess
            {
                adjustedFlag = true,
                adjustmentDescription = "test description",
                adjustmentReasonCode = 00,
                transactionLinkNumber = "9000001"
            };

            var voucherBatch = new VoucherBatch
            {
                scannedBatchNumber = "67500125",
                collectingBank = "082401"
            };

            var voucherInfo = new VoucherInformation
            {
                voucher = voucher,
                voucherProcess = voucherProcess,
                voucherBatch = voucherBatch
            };

            return voucherInfo;

        }
Пример #4
0
        public Document GeneratePdfFromTemplate(VoucherInformation voucher, string branchName)
        {
            var template = aspose.GetPdfFormTemplate(pdfTemplate);

            foreach (var fieldname in template.FieldNames)
            {
                var field = template.GetFullFieldName(fieldname);
                switch (fieldname)
                {
                    case "Date":
                        {
                            aspose.FillAndFlattenField(template, field, DateTime.Today.ToString("dd MMMM yyyy"));
                            break;
                        }

                    case "NameAddress":
                        {
                            aspose.FillField(template, field, "[NameAddress - first line here]");
                            break;
                        }

                    case "CustomerName":
                        {
                            aspose.FillField(template, field, "[CustomerName]");
                            break;
                        }

                    case "LetterBody":
                        {
                            var bsbNumber = string.Join("-", voucher.voucherBatch.collectingBank.Substring(0, 3), voucher.voucherBatch.collectingBank.Substring(3, 3));
                            var body = "I'm writing to let you know that your deposit on " + voucher.voucher.processingDate.ToShortDateString() + " at " + bsbNumber + ", " + branchName + " branch was found to be out of balance when we processed it. We have now adjusted your deposit.";
                            aspose.FillAndFlattenField(template, field, body);
                            break;
                        }

                    case "BranchNo":
                        {
                            aspose.FillAndFlattenField(template, field, voucher.voucherBatch.collectingBank);
                            break;
                        }

                    case "AccountNo":
                        {
                            aspose.FillField(template, fieldname, voucher.voucher.accountNumber);
                            break;
                        }

                    case "AgentNo":
                        {
                            aspose.FillAndFlattenField(template, field, voucher.voucher.extraAuxDom);
                            break;
                        }

                    case "OriginalDepositAmount":
                        {
                            var dollarAmount = (Convert.ToDecimal(voucher.voucherProcess.preAdjustmentAmount) / 100m).ToString("C2");

                            aspose.FillAndFlattenField(template, field, dollarAmount);
                            break;
                        }

                    case "AdjustmentReason":
                        {
                            aspose.FillAndFlattenField(template, field, voucher.voucherProcess.adjustmentDescription);

                            break;
                        }

                    case "ErrorAmount":
                        {
                            var errorAmount = (Math.Abs(Convert.ToDecimal(voucher.voucher.amount) - Convert.ToDecimal(voucher.voucherProcess.preAdjustmentAmount)) / 100m).ToString("C2");

                            aspose.FillAndFlattenField(template, field, errorAmount);
                            break;
                        }

                    case "AdjustedAmount":
                        {
                            var dollarAmount = (Convert.ToDecimal(voucher.voucher.amount) / 100m).ToString("C2");

                            aspose.FillAndFlattenField(template, field, dollarAmount);

                            break;
                        }

                    case "AdviceReference":
                        {
                            var reference = voucher.voucher.documentReferenceNumber + " [" + voucher.voucherProcess.adjustmentReasonCode + "]";
                            aspose.FillAndFlattenField(template, field, reference);
                            break;
                        }
                }
            }

            return template.Document;
        }