Example #1
0
 public RetailSalesInvoice ConfirmObject(RetailSalesInvoice retailSalesInvoice, DateTime ConfirmationDate, int ContactId,
                                         IRetailSalesInvoiceDetailService _retailSalesInvoiceDetailService, IContactService _contactService,
                                         IPriceMutationService _priceMutationService, IReceivableService _receivableService,
                                         IRetailSalesInvoiceService _retailSalesInvoiceService, IWarehouseItemService _warehouseItemService,
                                         IWarehouseService _warehouseService, IItemService _itemService, IBarringService _barringService,
                                         IStockMutationService _stockMutationService, IClosingService _closingService)
 {
     retailSalesInvoice.ContactId        = ContactId;
     retailSalesInvoice.ConfirmationDate = ConfirmationDate;
     if (_validator.ValidConfirmObject(retailSalesInvoice, _retailSalesInvoiceDetailService, _retailSalesInvoiceService, _warehouseItemService, _contactService))
     {
         IList <RetailSalesInvoiceDetail> retailSalesInvoiceDetails = _retailSalesInvoiceDetailService.GetObjectsByRetailSalesInvoiceId(retailSalesInvoice.Id);
         retailSalesInvoice.Total = 0;
         retailSalesInvoice.CoGS  = 0;
         foreach (var retailSalesInvoiceDetail in retailSalesInvoiceDetails)
         {
             retailSalesInvoiceDetail.Errors = new Dictionary <string, string>();
             _retailSalesInvoiceDetailService.ConfirmObject(retailSalesInvoiceDetail, _retailSalesInvoiceService, _warehouseItemService,
                                                            _warehouseService, _itemService, _barringService, _stockMutationService);
             retailSalesInvoice.Total += retailSalesInvoiceDetail.Amount;
             retailSalesInvoice.CoGS  += retailSalesInvoiceDetail.CoGS;
         }
         // Tax dihitung setelah Discount
         retailSalesInvoice.Total = (retailSalesInvoice.Total * ((100 - retailSalesInvoice.Discount) / 100) * ((100 + retailSalesInvoice.Tax) / 100));
         Receivable receivable = _receivableService.CreateObject(retailSalesInvoice.ContactId, Core.Constants.Constant.ReceivableSource.RetailSalesInvoice, retailSalesInvoice.Id, retailSalesInvoice.Code, retailSalesInvoice.Total, (DateTime)retailSalesInvoice.DueDate.GetValueOrDefault());
         retailSalesInvoice = _repository.ConfirmObject(retailSalesInvoice);
     }
     else
     {
         retailSalesInvoice.ConfirmationDate = null;
         //retailSalesInvoice.ContactId = 0; //null;
     }
     return(retailSalesInvoice);
 }
Example #2
0
        public RetailSalesInvoice UnpaidObject(RetailSalesInvoice retailSalesInvoice, IReceiptVoucherService _receiptVoucherService, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                               ICashBankService _cashBankService, IReceivableService _receivableService, ICashMutationService _cashMutationService,
                                               IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            if (_validator.ValidUnpaidObject(retailSalesInvoice))
            {
                Receivable             receivable      = _receivableService.GetObjectBySource(Core.Constants.Constant.ReceivableSource.RetailSalesInvoice, retailSalesInvoice.Id);
                IList <ReceiptVoucher> receiptVouchers = _receiptVoucherService.GetObjectsByCashBankId((int)retailSalesInvoice.CashBankId.GetValueOrDefault());
                foreach (var receiptVoucher in receiptVouchers)
                {
                    if (receiptVoucher.ContactId == retailSalesInvoice.ContactId)
                    {
                        receiptVoucher.Errors = new Dictionary <string, string>();
                        _receiptVoucherService.UnconfirmObject(receiptVoucher, _receiptVoucherDetailService, _cashBankService, _receivableService,
                                                               _cashMutationService, _generalLedgerJournalService, _accountService, _closingService);

                        IList <ReceiptVoucherDetail> receiptVoucherDetails = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);
                        foreach (var receiptVoucherDetail in receiptVoucherDetails)
                        {
                            _receiptVoucherDetailService.SoftDeleteObject(receiptVoucherDetail);
                        }
                        _receiptVoucherService.SoftDeleteObject(receiptVoucher, _receiptVoucherDetailService);
                    }
                }
                retailSalesInvoice.AmountPaid    = 0;
                retailSalesInvoice.IsFullPayment = false;
                retailSalesInvoice = _repository.UnpaidObject(retailSalesInvoice);
            }
            return(retailSalesInvoice);
        }
Example #3
0
        public ReceiptVoucher UnreconcileObject(ReceiptVoucher receiptVoucher, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                                ICashMutationService _cashMutationService, ICashBankService _cashBankService, IReceivableService _receivableService)
        {
            if (_validator.ValidUnreconcileObject(receiptVoucher))
            {
                _repository.UnreconcileObject(receiptVoucher);

                CashBank             cashBank      = _cashBankService.GetObjectById(receiptVoucher.CashBankId);
                IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForReceiptVoucher(receiptVoucher, cashBank);
                foreach (var cashMutation in cashMutations)
                {
                    _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService);
                }

                IList <ReceiptVoucherDetail> receiptVoucherDetails = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);
                foreach (var receiptVoucherDetail in receiptVoucherDetails)
                {
                    Receivable receivable = _receivableService.GetObjectById(receiptVoucherDetail.ReceivableId);
                    receivable.PendingClearanceAmount += receiptVoucherDetail.Amount;
                    if (receivable.PendingClearanceAmount != 0 || receivable.RemainingAmount != 0)
                    {
                        receivable.IsCompleted    = false;
                        receivable.CompletionDate = null;
                    }
                    _receivableService.UpdateObject(receivable);
                }
            }
            return(receiptVoucher);
        }
 public CashSalesInvoice UnconfirmObject(CashSalesInvoice cashSalesInvoice, ICashSalesInvoiceDetailService _cashSalesInvoiceDetailService,
                                         IReceivableService _receivableService, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                         IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService, IItemService _itemService,
                                         IBarringService _barringService, IStockMutationService _stockMutationService,
                                         IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService,
                                         IClosingService _closingService)
 {
     if (_validator.ValidUnconfirmObject(cashSalesInvoice, _cashSalesInvoiceDetailService, _receivableService, _receiptVoucherDetailService,
                                         _closingService))
     {
         IList <CashSalesInvoiceDetail> cashSalesInvoiceDetails = _cashSalesInvoiceDetailService.GetObjectsByCashSalesInvoiceId(cashSalesInvoice.Id);
         foreach (var cashSalesInvoiceDetail in cashSalesInvoiceDetails)
         {
             cashSalesInvoiceDetail.Errors = new Dictionary <string, string>();
             _cashSalesInvoiceDetailService.UnconfirmObject(cashSalesInvoiceDetail, _warehouseItemService, _warehouseService, _itemService, _barringService, _stockMutationService);
         }
         Receivable receivable = _receivableService.GetObjectBySource(Core.Constants.Constant.ReceivableSource.CashSalesInvoice, cashSalesInvoice.Id);
         _receivableService.SoftDeleteObject(receivable);
         _generalLedgerJournalService.CreateUnconfirmationJournalForCashSalesInvoice(cashSalesInvoice, _accountService);
         cashSalesInvoice.CoGS     = 0;
         cashSalesInvoice.Total    = 0;
         cashSalesInvoice.Discount = 0;
         cashSalesInvoice.Tax      = 0;
         cashSalesInvoice          = _repository.UnconfirmObject(cashSalesInvoice);
     }
     return(cashSalesInvoice);
 }
Example #5
0
        private void ProcessPurchaseInvoice(string accountMonth)
        {
            // 進貨資料
            var query = from u in this._PurchaseInvoice.GetAll()
                        .Where(x => x.Activate == YesNo.Yes.Value && x.AccountMonth == accountMonth)
                        select new
            {
                InvoiceID    = u.InvoiceID,
                SupplierID   = u.SupplierID,
                AccountMonth = u.AccountMonth,
                InvoiceDate  = u.InvoiceDate,
                Tax          = u.Tax
            };

            query.ToList().ForEach(x =>
            {
                var info = new Receivable()
                {
                    VoucherID    = x.InvoiceID,
                    CompanyID    = x.SupplierID,
                    AccountMonth = x.AccountMonth,
                    DealDate     = x.InvoiceDate,
                    DealItem     = DealItem.PurchaseInvoice.Text,
                    PurchaseTax  = x.Tax
                };

                info = ProcessReceivable(info);
                this._Repository.Create(info);
            });
        }
Example #6
0
        public ReceiptVoucher ReconcileObject(ReceiptVoucher receiptVoucher, DateTime ReconciliationDate,
                                              IReceiptVoucherDetailService _receiptVoucherDetailService, ICashMutationService _cashMutationService,
                                              ICashBankService _cashBankService, IReceivableService _receivableService)
        {
            receiptVoucher.ReconciliationDate = ReconciliationDate;
            if (_validator.ValidReconcileObject(receiptVoucher))
            {
                _repository.ReconcileObject(receiptVoucher);

                CashBank     cashBank     = _cashBankService.GetObjectById(receiptVoucher.CashBankId);
                CashMutation cashMutation = _cashMutationService.CreateCashMutationForReceiptVoucher(receiptVoucher, cashBank);
                _cashMutationService.CashMutateObject(cashMutation, _cashBankService);

                IList <ReceiptVoucherDetail> receiptVoucherDetails = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);
                foreach (var receiptVoucherDetail in receiptVoucherDetails)
                {
                    Receivable receivable = _receivableService.GetObjectById(receiptVoucherDetail.ReceivableId);
                    receivable.PendingClearanceAmount -= receiptVoucherDetail.Amount;
                    if (receivable.PendingClearanceAmount == 0 && receivable.RemainingAmount == 0)
                    {
                        receivable.IsCompleted    = true;
                        receivable.CompletionDate = DateTime.Now;
                    }
                    _receivableService.UpdateObject(receivable);
                }
            }
            return(receiptVoucher);
        }
Example #7
0
        // GET: Premiums/Create
        public async Task <IActionResult> Create(Guid productId, Guid clientId, Guid policyId)
        {
            Receivable receivable = new Receivable
            {
                ReceivableDate = DateTime.Now
            };

            Premium premium = new Premium
            {
                PremiumDate = DateTime.Now
            };

            PremiumViewModel viewModel = new PremiumViewModel
            {
                ProductID       = productId,
                ClientID        = clientId,
                PolicyID        = policyId,
                Receivable      = receivable,
                Premium         = premium,
                PaymentTypeList = new SelectList(await _context.PaymentTypes.AsNoTracking().ToListAsync(),
                                                 "ID", "Name"),
                PremiumTypeList = new SelectList(await _context.PremiumTypes.AsNoTracking().ToListAsync(),
                                                 "ID", "Name")
            };

            return(View(viewModel));
        }
Example #8
0
        private Model.Receivable GetInfoOnDelete(Receivable info)
        {
            info.LastPerson = _CurrentUser.UserID;;
            info.LastUpdate = DateTime.Now;

            return(info);
        }
        public async Task <ActionResult <Receivable> > PostReceivable(Receivable receivable)
        {
            _context.Receivables.Add(receivable);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetReceivable", new { id = receivable.ReceivableId }, receivable));
        }
        public async Task <IActionResult> PutReceivable(long id, Receivable receivable)
        {
            if (id != receivable.ReceivableId)
            {
                return(BadRequest());
            }

            _context.Entry(receivable).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ReceivableExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #11
0
 private void CheckBusinessRules(Receivable info)
 {
     //if (this._ReceivableService.IsCheckNumExists(info))
     //{
     //    ModelState.AddModelError("CheckNum", $"支票號碼:{ info.CheckNum },已經存在。");
     //}
 }
        public bool ActiveReceivableCheque(ChequeDetails chequeDetails, Receivable aReceivable, Client aClient)
        {
            aReceivable.VoucherNo = GetMaxVoucherNoByTransactionInfix("101");
            int rowAffected = _iAccountGateway.ActiveReceivableCheque(chequeDetails, aReceivable, aClient);

            return(rowAffected > 0);
        }
        public CashSalesInvoice PaidObject(CashSalesInvoice cashSalesInvoice, decimal AmountPaid, decimal Allowance, ICashBankService _cashBankService, IReceivableService _receivableService,
                                           IReceiptVoucherService _receiptVoucherService, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                           IContactService _contactService, ICashMutationService _cashMutationService, ICashSalesReturnService _cashSalesReturnService,
                                           IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            cashSalesInvoice.AmountPaid = AmountPaid;
            cashSalesInvoice.Allowance  = Allowance;
            if (_validator.ValidPaidObject(cashSalesInvoice, _cashBankService, _receiptVoucherService, _cashSalesReturnService, _closingService))
            {
                CashBank cashBank = _cashBankService.GetObjectById((int)cashSalesInvoice.CashBankId.GetValueOrDefault());
                cashSalesInvoice.IsBank = cashBank.IsBank;

                if (cashSalesInvoice.AmountPaid + cashSalesInvoice.Allowance == cashSalesInvoice.Total)
                {
                    cashSalesInvoice.IsFullPayment = true;
                }
                Receivable receivable = _receivableService.GetObjectBySource(Core.Constants.Constant.ReceivableSource.CashSalesInvoice, cashSalesInvoice.Id);
                receivable.AllowanceAmount = Allowance;
                receivable.RemainingAmount = receivable.Amount - receivable.AllowanceAmount;
                _receivableService.UpdateObject(receivable);
                ReceiptVoucher receiptVoucher = _receiptVoucherService.CreateObject((int)cashSalesInvoice.CashBankId.GetValueOrDefault(), receivable.ContactId, DateTime.Now, cashSalesInvoice.AmountPaid.GetValueOrDefault() /*receivable.RemainingAmount*/,
                                                                                    false, (DateTime)cashSalesInvoice.DueDate.GetValueOrDefault(), cashSalesInvoice.IsBank, _receiptVoucherDetailService,
                                                                                    _receivableService, _contactService, _cashBankService);
                ReceiptVoucherDetail receiptVoucherDetail = _receiptVoucherDetailService.CreateObject(receiptVoucher.Id, receivable.Id, cashSalesInvoice.AmountPaid.GetValueOrDefault(),
                                                                                                      "Automatic Payment", _receiptVoucherService, _cashBankService, _receivableService);
                cashSalesInvoice = _repository.PaidObject(cashSalesInvoice);
                _generalLedgerJournalService.CreatePaidJournalForCashSalesInvoice(cashSalesInvoice, _accountService);
                _receiptVoucherService.ConfirmObject(receiptVoucher, (DateTime)cashSalesInvoice.ConfirmationDate.GetValueOrDefault(), _receiptVoucherDetailService, _cashBankService,
                                                     _receivableService, _cashMutationService, _generalLedgerJournalService, _accountService, _closingService);
            }
            return(cashSalesInvoice);
        }
Example #14
0
        public RetailSalesInvoice PaidObject(RetailSalesInvoice retailSalesInvoice, decimal AmountPaid, ICashBankService _cashBankService, IReceivableService _receivableService,
                                             IReceiptVoucherService _receiptVoucherService, IReceiptVoucherDetailService _receiptVoucherDetailService, IContactService _contactService,
                                             ICashMutationService _cashMutationService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            retailSalesInvoice.AmountPaid = AmountPaid;
            if (_validator.ValidPaidObject(retailSalesInvoice, _cashBankService, _receiptVoucherService))
            {
                CashBank cashBank = _cashBankService.GetObjectById((int)retailSalesInvoice.CashBankId.GetValueOrDefault());
                retailSalesInvoice.IsBank = cashBank.IsBank;

                if (!retailSalesInvoice.IsGBCH)
                {
                    retailSalesInvoice.GBCH_No     = null;
                    retailSalesInvoice.Description = null;
                }
                if (retailSalesInvoice.AmountPaid == retailSalesInvoice.Total)
                {
                    retailSalesInvoice.IsFullPayment = true;
                }
                Receivable     receivable     = _receivableService.GetObjectBySource(Core.Constants.Constant.ReceivableSource.RetailSalesInvoice, retailSalesInvoice.Id);
                ReceiptVoucher receiptVoucher = _receiptVoucherService.CreateObject((int)retailSalesInvoice.CashBankId.GetValueOrDefault(), retailSalesInvoice.ContactId, DateTime.Now, retailSalesInvoice.Total,
                                                                                    retailSalesInvoice.IsGBCH, (DateTime)retailSalesInvoice.DueDate.GetValueOrDefault(), retailSalesInvoice.IsBank, _receiptVoucherDetailService,
                                                                                    _receivableService, _contactService, _cashBankService);
                ReceiptVoucherDetail receiptVoucherDetail = _receiptVoucherDetailService.CreateObject(receiptVoucher.Id, receivable.Id, (decimal)retailSalesInvoice.AmountPaid.GetValueOrDefault(),
                                                                                                      "Automatic Payment", _receiptVoucherService, _cashBankService, _receivableService);
                retailSalesInvoice = _repository.PaidObject(retailSalesInvoice);
                _receiptVoucherService.ConfirmObject(receiptVoucher, (DateTime)retailSalesInvoice.ConfirmationDate, _receiptVoucherDetailService, _cashBankService,
                                                     _receivableService, _cashMutationService, _generalLedgerJournalService, _accountService, _closingService);
            }
            return(retailSalesInvoice);
        }
        public SalesInvoice ConfirmObject(SalesInvoice salesInvoice, DateTime ConfirmationDate, ISalesInvoiceDetailService _salesInvoiceDetailService, ISalesOrderService _salesOrderService,
                                          IDeliveryOrderService _deliveryOrderService, IDeliveryOrderDetailService _deliveryOrderDetailService, IReceivableService _receivableService)
        {
            salesInvoice.ConfirmationDate = ConfirmationDate;
            if (_validator.ValidConfirmObject(salesInvoice, _salesInvoiceDetailService, _deliveryOrderService, _deliveryOrderDetailService))
            {
                // confirm details
                // add all amount into amountreceivable
                IList <SalesInvoiceDetail> details = _salesInvoiceDetailService.GetObjectsBySalesInvoiceId(salesInvoice.Id);
                foreach (var detail in details)
                {
                    detail.Errors = new Dictionary <string, string>();
                    _salesInvoiceDetailService.ConfirmObject(detail, ConfirmationDate, _deliveryOrderDetailService);
                }
                salesInvoice = CalculateAmountReceivable(salesInvoice, _salesInvoiceDetailService);

                // confirm object
                // create receivable
                salesInvoice = _repository.ConfirmObject(salesInvoice);
                DeliveryOrder deliveryOrder = _deliveryOrderService.GetObjectById(salesInvoice.DeliveryOrderId);
                _deliveryOrderService.CheckAndSetInvoiceComplete(deliveryOrder, _deliveryOrderDetailService);
                SalesOrder salesOrder = _salesOrderService.GetObjectById(deliveryOrder.SalesOrderId);
                Receivable receivable = _receivableService.CreateObject(salesOrder.ContactId, Constant.ReceivableSource.SalesInvoice, salesInvoice.Id, salesInvoice.AmountReceivable, salesInvoice.DueDate);
            }
            return(salesInvoice);
        }
Example #16
0
 public bool IsUsed(Receivable info)
 {
     //var query = this._Repository.Get(x => x.VoucherID == info.VoucherID);
     //var result = query.Product.Any();
     //this._Repository.HandleDetached(query); //
     //return result;
     return(true);
 }
Example #17
0
        public bool Remove(Receivable entity)
        {
            Receivable a = dt.Receivables.Where(t => t.ReceivableID == entity.ReceivableID).FirstOrDefault();

            dt.Receivables.DeleteOnSubmit(a);
            dt.SubmitChanges();
            return(true);
        }
        public int SaveReceivable(Receivable receivable)
        {
            int maxSl = GetMaxReceivableSerialNoOfCurrentYear();

            receivable.ReceivableRef = GenerateReceivableRef(maxSl);
            receivable.ReceivableNo  = GenerateReceivableNo(maxSl);
            return(_iAccountGateway.SaveReceivable(receivable));
        }
Example #19
0
        private Receivable GetInfoOnUpdate(Receivable source)
        {
            Receivable info = Mapper.Map <Receivable>(source);

            info.LastPerson = IdentityService.GetUserData().UserID;
            info.LastUpdate = DateTime.Now;
            return(info);
        }
Example #20
0
        public async Task InsertReceivableTest()
        {
            var bankAccount = new BankAccount
            {
                Branch         = "1144",
                Account        = "13341",
                AccountDigit   = "X5",
                AccountType    = BankAccountType.CC,
                Ispb           = "12345678",
                DocumentType   = DocumentType.CNPJ,
                DocumentNumber = "34144310000100"
            };

            var settlement = new ReceivableSettlement()
            {
                Reference                = "L_1875",
                AssetHolder              = "34144310000100",
                AssetHolderDocumentType  = DocumentType.CPF,
                SettlementDate           = DateTime.Parse("2020-02-02"),
                SettlementObligationDate = DateTime.Parse("2021-11-01"),
                Amount      = 100.00M,
                BankAccount = bankAccount
            };

            var settlements = new List <ReceivableSettlement>
            {
                settlement
            };

            var receivable = new Receivable()
            {
                Reference     = "UR_450",
                DueDate       = DateTime.Now.AddDays(1),
                PaymentScheme = "VCC",
                OriginalAssetHolderDocumentType = DocumentType.CPF,
                OriginalAssetHolder             = "34144310000100",
                Amount        = 50000.00M,
                PrePaidAmount = 0,
                BankAccount   = bankAccount,
                Settlements   = settlements
            };

            var processReference = "PR_550";
            var receivables      = new List <Receivable>
            {
                receivable
            };
            var rI = new ReceivableRequest
            {
                ProcessReference = processReference,
                Receivables      = receivables
            };

            var result = await _tService.RegisterReceivable(rI);

            Print(result);
        }
Example #21
0
        private void InitViewBag(Receivable info)
        {
            ViewBag.AccountMonth = DateTime.Today.AddMonths(-1).ToString("yyMM");

            //ViewBag.BankAccountList =
            //   new SelectList(this._GlobalService.GetBankAccountList(), "Value", "Text", info?.BankAccountID);

            //ViewBag.YseNoList =
            //new SelectList(YesNo.GetAll(), "value", "Text", info?.Activate);
        }
        public ReceiptVoucherDetail VHasReceivable(ReceiptVoucherDetail receiptVoucherDetail, IReceivableService _receivableService)
        {
            Receivable receivable = _receivableService.GetObjectById(receiptVoucherDetail.ReceivableId);

            if (receivable == null)
            {
                receiptVoucherDetail.Errors.Add("Receivable", "Tidak boleh tidak ada");
            }
            return(receiptVoucherDetail);
        }
        public ReceiptVoucherDetail VReceivableHasNotBeenCompleted(ReceiptVoucherDetail receiptVoucherDetail, IReceivableService _receivableService)
        {
            Receivable receivable = _receivableService.GetObjectById(receiptVoucherDetail.ReceivableId);

            if (receivable.IsCompleted)
            {
                receiptVoucherDetail.Errors.Add("Generic", "Receivable sudah complete");
            }
            return(receiptVoucherDetail);
        }
        public ReceiptVoucherDetail VAmountLessOrEqualReceivable(ReceiptVoucherDetail receiptVoucherDetail, IReceivableService _receivableService)
        {
            Receivable receivable = _receivableService.GetObjectById(receiptVoucherDetail.ReceivableId);

            if (receiptVoucherDetail.Amount > receivable.Amount)
            {
                receiptVoucherDetail.Errors.Add("Amount", "Tidak boleh lebih dari receivable");
            }
            return(receiptVoucherDetail);
        }
Example #25
0
 public Receivable VReceivableSource(Receivable receivable)
 {
     if (!receivable.ReceivableSource.Equals(Core.Constants.Constant.ReceivableSource.CashSalesInvoice) &&
         !receivable.ReceivableSource.Equals(Core.Constants.Constant.ReceivableSource.RetailSalesInvoice) &&
         !receivable.ReceivableSource.Equals(Core.Constants.Constant.ReceivableSource.SalesInvoice))
     {
         receivable.Errors.Add("Generic", "Harus merupakan bagian dari Constant.ReceivableSource");
     }
     return(receivable);
 }
Example #26
0
        public int SaveReceivable(Receivable receivable)
        {
            int maxSl      = GetMaxReceivableSerialNoOfCurrentYear();
            var receiveRef = GenerateReceivableRef(maxSl);

            receivable.ReceivableRef = receiveRef;
            receivable.MessageModel.TransactionRef = receiveRef;
            receivable.ReceivableNo = GenerateReceivableNo(maxSl);
            return(_iAccountGateway.SaveReceivable(receivable));
        }
Example #27
0
        public void Delete(Receivable info)
        {
            if (info == null)//沒有資料
            {
                throw new Exception("MessageNoData".ToLocalized());
            }

            this._Repository.Delete(info);
            this._UnitOfWork.SaveChange();
        }
        public JsonResult ApproveCashAmount(FormCollection collection)
        {
            SuccessErrorModel aModel = new SuccessErrorModel();

            try
            {
                var      anUser        = (ViewUser)Session["user"];
                int      detailsId     = Convert.ToInt32(collection["ChequeDetailsId"]);
                var      chequeDetails = _iAccountsManager.GetReceivableChequeByDetailsId(detailsId);
                Client   aClient       = _iClientManager.GetById(chequeDetails.ClientId);
                DateTime date          = DateTime.Now;
                //Demo  bankCode = "3308011";
                string bankCode = "3105011";

                int        branchId    = Convert.ToInt32(Session["BranchId"]);
                int        companyId   = Convert.ToInt32(Session["CompanyId"]);
                Receivable aReceivable = new Receivable
                {
                    TransactionRef       = chequeDetails.ReceivableRef,
                    SubSubSubAccountCode = bankCode,
                    ReceivableDateTime   = date,
                    BranchId             = branchId,
                    CompanyId            = companyId,
                    Paymode = 'C',
                    UserId  = anUser.UserId,
                    Remarks = "Active receivable by " + anUser.UserId
                };
                bool result = _iAccountsManager.ActiveReceivableCheque(chequeDetails, aReceivable, aClient);
                //if (result)
                //{
                //    //---------Send Mail ----------------
                //    var body = $"Dear {aClient.ClientName}, your receivalbe amount is receive by NBL. thanks and regards Accounts Departments NBL.";
                //    var subject = $"Receiable Confirm at {DateTime.Now}";
                //    var message = new MailMessage();
                //    message.To.Add(new MailAddress(aClient.Email));  // replace with valid value
                //    message.Subject = subject;
                //    message.Body = string.Format(body);
                //    message.IsBodyHtml = true;
                //    using (var smtp = new SmtpClient())
                //    {
                //        smtp.Send(message);
                //    }
                //    //------------End Send Mail-------------
                //}
                aModel.Message = result ? "<p class='text-green'> Cash Amount Approved Successfully!</p>" : "<p class='text-danger'> Failed to  Approve Cash Amount! </p>";
            }
            catch (Exception exception)
            {
                string message = exception.Message;
                aModel.Message = " <p style='color:red'>" + message + "</p>";
                Log.WriteErrorLog(exception);
            }
            return(Json(aModel, JsonRequestBehavior.AllowGet));
        }
Example #29
0
        public SalesInvoice VHasReceiptVoucherDetails(SalesInvoice salesInvoice, IReceivableService _receivableService, IReceiptVoucherDetailService _receiptVoucherDetailService)
        {
            Receivable receivable = _receivableService.GetObjectBySource(Constant.ReceivableSource.SalesInvoice, salesInvoice.Id);
            IList <ReceiptVoucherDetail> pvdetails = _receiptVoucherDetailService.GetObjectsByReceivableId(receivable.Id);

            if (pvdetails.Any())
            {
                salesInvoice.Errors.Add("Generic", "Tidak boleh sudah ada proses pembayaran");
            }
            return(salesInvoice);
        }
        public async Task Consume(ReceiveContext <OrderItemAdded> messageContext)
        {
            Guard.NotNull(messageContext, nameof(messageContext));
            var message         = messageContext.Message;
            var customerBalance = await this.repository.Get(message.CustomerId);

            var receivable = Receivable.Create(message.OrderId, message.OrderTotal);

            customerBalance.BookReceivable(receivable);
            await this.repository.Save(customerBalance);
        }