public void SaveOrUpdateReceive()
        {
            Receive receive = CurrentReceive;

            if (receive.Id <= 0)
            {
                receive.ReceiveNo = View.GetReceiveNo;
            }
            receive.ReceiveDate = Convert.ToDateTime(DateTime.Today.ToShortDateString());
            receive.DeliveredBy = View.GetDeliveredBy;
            receive.InvoiceNo   = View.GetInvoiceNo;
            receive.Program     = _settingController.GetProgram(View.GetProgram);
            receive.Project     = _settingController.GetProject(View.GetProject);
            receive.Grant       = _settingController.GetGrant(View.GetGrant);
            receive.Receiver    = _adminController.GetUser(CurrentUser().Id).Id;
            receive.Supplier    = _settingController.GetSupplier(View.GetSupplier);

            foreach (ReceiveDetail recDet in CurrentReceive.ReceiveDetails)
            {
                if (recDet.Item.ItemType == "Fixed Asset")
                {
                    for (int i = 1; i <= recDet.Quantity; i++)
                    {
                        FixedAsset fa = new FixedAsset();
                        fa.Item        = recDet.Item;
                        fa.ReceiveDate = CurrentReceive.ReceiveDate;
                        fa.Supplier    = CurrentReceive.Supplier;
                        fa.Store       = recDet.Store;
                        fa.Section     = recDet.Section;
                        fa.Shelf       = recDet.Shelf;
                        fa.ReceiveNo   = CurrentReceive.ReceiveNo;
                        fa.Custodian   = "Store";
                        fa.UnitCost    = recDet.UnitCost;
                        fa.AssetStatus = "Received";

                        FixedAssetHistory fah = new FixedAssetHistory();
                        fah.Custodian       = "Store";
                        fah.Operation       = "Receive";
                        fah.TransactionDate = DateTime.Now;

                        fa.FixedAssetHistories.Add(fah);

                        _controller.SaveOrUpdateEntity(fa);
                    }
                }
            }

            _controller.SaveOrUpdateEntity(receive);
        }
        public void SaveOrUpdateCashPaymentRequest()
        {
            CashPaymentRequest cashPaymentRequest = CurrentCashPaymentRequest;

            if (cashPaymentRequest.Id <= 0)
            {
                cashPaymentRequest.RequestNo = View.GetRequestNo;
                cashPaymentRequest.VoucherNo = View.GetVoucherNo;
            }
            cashPaymentRequest.RequestDate    = Convert.ToDateTime(DateTime.Today.ToShortDateString());
            cashPaymentRequest.Description    = View.GetDescription;
            cashPaymentRequest.AmountType     = View.GetAmountType;
            cashPaymentRequest.RequestType    = View.GetRequestType;
            cashPaymentRequest.Program        = _settingController.GetProgram(View.GetProgram);
            cashPaymentRequest.ProgressStatus = ProgressStatus.InProgress.ToString();
            cashPaymentRequest.AppUser        = _adminController.GetUser(CurrentUser().Id);
            //Check if the Payee is the logged in employee or a supplier
            if (View.GetPayee == -1)
            {
                cashPaymentRequest.Payee = CurrentUser().FullName;
            }
            else
            {
                cashPaymentRequest.Supplier = _settingController.GetSupplier(View.GetPayee);
            }

            if (View.GetAmountType != "Actual Amount")
            {
                cashPaymentRequest.PaymentReimbursementStatus = "Not Retired";
            }
            else
            {
                cashPaymentRequest.PaymentReimbursementStatus = "Retired";
                cashPaymentRequest.TotalActualExpendture      = cashPaymentRequest.TotalAmount;
            }

            cashPaymentRequest.ExportStatus = "Not Exported";
            cashPaymentRequest.IsLiquidated = false;

            if (CurrentCashPaymentRequest.CashPaymentRequestStatuses.Count == 0)
            {
                SaveCashPaymentRequestStatus();
            }

            GetCurrentApprover();

            _controller.SaveOrUpdateEntity(cashPaymentRequest);
        }
 public Program GetProgram(int id)
 {
     return(_settingController.GetProgram(id));
 }
 public Program GetProgram(int programID)
 {
     return(_controller.GetProgram(programID));
 }
Example #5
0
 public Program GetProgramById(int id)
 {
     return(_controller.GetProgram(id));
 }
Example #6
0
 public Program GetProgram(int programId)
 {
     return(_settingcontroller.GetProgram(programId));
 }