private Ariv _checkbyInvoiceno(string invoiceno) { Ariv ariv = new Ariv(_dbpath); ariv.checkPayment(invoiceno); return(ariv); }
public UpdateBills(List <OutstandingBill> outstandingBills, string dbpath) { _outStandingBills = outstandingBills; _dbpath = dbpath; _updatedBills = new List <OutstandingBill>(); _arpm = new Arpm(_dbpath); _ariv = new Ariv(_dbpath); _checkPayment(); }
public void insertPayments() { foreach (AppPayments payment in _adyenPayments) { Console.WriteLine($"Checking payments for {payment.invoice_no} \n"); Ariv ariv = _checkbyInvoiceno(payment.invoice_no); int gltransid = _gltrans.nextTransid(); if (!String.IsNullOrEmpty(ariv.DOCNO)) { Console.WriteLine($"Recording the amount of {_convertAmount(payment.amount_paid)} for invoice : {payment.invoice_no}\n"); // _addGltrans(payment, "M", $"N{payment.code}", gltransid); _addGltrans(payment, "M", $"{payment.unit_name}", gltransid); _addGltrans(payment, "S", "310-000", gltransid); int paymentDockey = _addPayment(payment, $"{payment.unit_name}", gltransid); _addKnockoff(payment, ariv.DOCKEY, paymentDockey); Console.WriteLine($"{ariv.PAYMENTAMT} + {_convertAmount(payment.amount_paid)}"); ariv.PAYMENTAMT = ariv.PAYMENTAMT + _convertAmount(payment.amount_paid); ariv.Update(ariv.DOCNO); // _adjustCustomerOutstanding(payment.amount_paid, $"N{payment.code}"); _adjustCustomerOutstanding(payment.amount_paid, $"{payment.unit_name}"); Console.WriteLine($"Updated payment : {ariv.PAYMENTAMT}\n"); } else { Console.WriteLine($"{payment.invoice_no} not found.\n"); } } // Export receipts if (_khReceipts.Count != 0) { _exportReceipts(_khReceipts); } }
public void buildExport() { Fbexplore fbexplore = new Fbexplore(ConfigurationManager.AppSettings["estream"]); if (!String.IsNullOrEmpty(fbexplore.LatestPath)) { Console.WriteLine($"Attempting to connect to latest DB : {fbexplore.LatestPath}\n"); try { // =================================== // Export new invoices to kiple home // =================================== Console.WriteLine($"Checking invoices for the past {ConfigurationManager.AppSettings["datespan"]} days.\n"); Ariv ariv = new Ariv(fbexplore.LatestPath); FbDataReader invoices = ariv.queryInvoice(); if (invoices.HasRows) { PosthocBill posthocBill = new PosthocBill(ref invoices); if (posthocBill.InvoiceLst.Count() != 0) { Console.WriteLine($"Invoice count: {posthocBill.InvoiceLst.Count()}\n"); ExportBill.dump(posthocBill.InvoiceLst, 0); } else { Console.WriteLine($"No invoice(s) found for the past {ConfigurationManager.AppSettings["datespan"]} days.\n"); } } else { Console.WriteLine($"No invoice(s) found for the past {ConfigurationManager.AppSettings["datespan"]} days.\n"); } // =================================================================================== // Check kiple home for pending invoices. Export payments back to kiple home if any. // =================================================================================== Console.WriteLine("Checking for pending payments: Connecting to Kiple Home ...\n"); AssertBills assertBills = new AssertBills(); if (!(assertBills.Bills is null) && assertBills.Bills.Count != 0) { Console.WriteLine($"Outstanding Bills from KipleHome : {assertBills.Bills.Count} \n"); UpdateBills updateBills = new UpdateBills(assertBills.Bills, fbexplore.LatestPath); updateBills.exportPayment(); } else { Console.WriteLine("No outstanding bills. \n"); } // ===================================================== // Check kiple home for payments made through KipleBiz // ===================================================== Console.WriteLine("Checking for payments made via KipleHome App ... \n"); AdyenPayment adyenPayment = new AdyenPayment(); if (!(adyenPayment.Payments is null) && adyenPayment.Payments.Count != 0) { Console.WriteLine($"Inserting {adyenPayment.Payments.Count} payment(s) to local database ... \n"); MakePayment makePayment = new MakePayment(adyenPayment.Payments, fbexplore.LatestPath); makePayment.insertPayments(); }