private void UploadFile()
        {
            string fileName = Path.GetFileName(fuReciept.PostedFile.FileName);

            if (fileName != String.Empty)
            {
                OCRAttachment attachment = new OCRAttachment();
                attachment.FilePath = "~/OCUploads/" + fileName;
                fuReciept.PostedFile.SaveAs(Server.MapPath("~/OCUploads/") + fileName);
                //Response.Redirect(Request.Url.AbsoluteUri);
                _presenter.CurrentOperationalControlRequest.OCRAttachments.Add(attachment);

                grvAttachments.DataSource = _presenter.CurrentOperationalControlRequest.OCRAttachments;
                grvAttachments.DataBind();
            }
            else
            {
                Master.ShowMessage(new AppMessage("Please select file ", Chai.WorkflowManagment.Enums.RMessageType.Error));
            }
        }
        private void PopulateBankPaymentDetail()
        {
            if (Request.QueryString["PaymentId"] != null)
            {
                CashPaymentRequest CPR = _presenter.GetCashPaymentRequest(Convert.ToInt32(Request.QueryString["PaymentId"]));
                if (CPR != null)
                {
                    _presenter.CurrentOperationalControlRequest.Description = CPR.Description;
                    foreach (CashPaymentRequestDetail CPRD in CPR.CashPaymentRequestDetails)
                    {
                        OperationalControlRequestDetail OCRD = new OperationalControlRequestDetail();
                        OCRD.ItemAccount      = CPRD.ItemAccount;
                        OCRD.Project          = CPRD.Project;
                        OCRD.Grant            = CPRD.Grant;
                        OCRD.Amount           = CPRD.Amount;
                        OCRD.ActualExpendture = CPRD.Amount;
                        OCRD.AccountCode      = CPRD.AccountCode;
                        _presenter.CurrentOperationalControlRequest.TotalAmount           += OCRD.Amount;
                        _presenter.CurrentOperationalControlRequest.TotalActualExpendture += OCRD.Amount;
                        OCRD.OperationalControlRequest = _presenter.CurrentOperationalControlRequest;
                        _presenter.CurrentOperationalControlRequest.OperationalControlRequestDetails.Add(OCRD);

                        if (CPRD.CPRAttachments.Count > 0)
                        {
                            foreach (CPRAttachment CP in CPRD.CPRAttachments)
                            {
                                OCRAttachment OPA = new OCRAttachment();

                                OPA.FilePath = CP.FilePath;
                                OPA.OperationalControlRequest = _presenter.CurrentOperationalControlRequest;
                                _presenter.CurrentOperationalControlRequest.OCRAttachments.Add(OPA);
                            }
                        }
                    }
                }
            }
        }
예제 #3
0
        private void PopulateBankPaymentDetail()
        {
            if (Request.QueryString["Page"] != null)
            {
                if (Request.QueryString["Page"].Contains("CashPayment"))
                {
                    CashPaymentRequest CPR = _presenter.GetCashPaymentRequest(Convert.ToInt32(Request.QueryString["PaymentId"]));
                    if (CPR != null)
                    {
                        foreach (CashPaymentRequestDetail CPRD in CPR.CashPaymentRequestDetails)
                        {
                            OperationalControlRequestDetail OCRD = new OperationalControlRequestDetail();
                            OCRD.ItemAccount      = CPRD.ItemAccount;
                            OCRD.Project          = CPRD.Project;
                            OCRD.Grant            = CPRD.Grant;
                            OCRD.Amount           = CPRD.Amount;
                            OCRD.ActualExpendture = CPRD.Amount;
                            OCRD.AccountCode      = CPRD.AccountCode;
                            _presenter.CurrentOperationalControlRequest.TotalAmount           += OCRD.Amount;
                            _presenter.CurrentOperationalControlRequest.TotalActualExpendture += OCRD.Amount;
                            OCRD.OperationalControlRequest = _presenter.CurrentOperationalControlRequest;
                            _presenter.CurrentOperationalControlRequest.OperationalControlRequestDetails.Add(OCRD);
                        }
                        if (CPR.CPRAttachments.Count > 0)
                        {
                            foreach (CPRAttachment CP in CPR.CPRAttachments)
                            {
                                OCRAttachment OPA = new OCRAttachment();

                                OPA.FilePath = CP.FilePath;
                                OPA.OperationalControlRequest = _presenter.CurrentOperationalControlRequest;
                                _presenter.CurrentOperationalControlRequest.OCRAttachments.Add(OPA);
                            }
                        }
                    }
                }

                else if (Request.QueryString["Page"].Contains("CostSharing"))
                {
                    CostSharingRequest CPR = _presenter.GetCostSharingPaymentRequest(Convert.ToInt32(Request.QueryString["PaymentId"]));
                    if (CPR != null)
                    {
                        foreach (CostSharingRequestDetail CPRD in CPR.CostSharingRequestDetails)
                        {
                            OperationalControlRequestDetail OCRD = new OperationalControlRequestDetail();
                            OCRD.ItemAccount      = CPRD.CostSharingRequest.ItemAccount;
                            OCRD.Project          = CPRD.Project;
                            OCRD.Grant            = CPRD.Grant;
                            OCRD.Amount           = CPRD.SharedAmount;
                            OCRD.ActualExpendture = CPRD.SharedAmount;
                            OCRD.AccountCode      = CPRD.CostSharingRequest.ItemAccount.AccountCode;
                            _presenter.CurrentOperationalControlRequest.TotalAmount           += OCRD.Amount;
                            _presenter.CurrentOperationalControlRequest.TotalActualExpendture += OCRD.Amount;
                            OCRD.OperationalControlRequest = _presenter.CurrentOperationalControlRequest;
                            _presenter.CurrentOperationalControlRequest.OperationalControlRequestDetails.Add(OCRD);
                        }
                        if (CPR.CSRAttachments.Count > 0)
                        {
                            foreach (CSRAttachment CP in CPR.CSRAttachments)
                            {
                                OCRAttachment OPA = new OCRAttachment();
                                OPA.FilePath = CP.FilePath;
                                OPA.OperationalControlRequest = _presenter.CurrentOperationalControlRequest;
                                _presenter.CurrentOperationalControlRequest.OCRAttachments.Add(OPA);
                            }
                        }
                    }
                }

                /*else if (Request.QueryString["Page"].Contains("TravelAdvance"))
                 * {
                 *  CostSharingRequest CPR = _presenter.GetCostSharingPaymentRequest(Convert.ToInt32(Request.QueryString["PaymentId"]));
                 *  if (CPR != null)
                 *  {
                 *
                 *
                 *      foreach (CostSharingRequestDetail CPRD in CPR.CostSharingRequestDetails)
                 *      {
                 *          OperationalControlRequestDetail OCRD = new OperationalControlRequestDetail();
                 *          OCRD.ItemAccount = CPRD.CostSharingRequest.ItemAccount;
                 *          OCRD.Project = CPRD.Project;
                 *          OCRD.Grant = CPRD.Grant;
                 *          OCRD.Amount = CPRD.SharedAmount;
                 *          OCRD.ActualExpendture = CPRD.SharedAmount;
                 *          OCRD.AccountCode = CPRD.CostSharingRequest.ItemAccount.AccountCode;
                 *          _presenter.CurrentOperationalControlRequest.TotalAmount += OCRD.Amount;
                 *          _presenter.CurrentOperationalControlRequest.TotalActualExpendture += OCRD.Amount;
                 *          OCRD.OperationalControlRequest = _presenter.CurrentOperationalControlRequest;
                 *          _presenter.CurrentOperationalControlRequest.OperationalControlRequestDetails.Add(OCRD);
                 *      }
                 *      if (CPR.CSRAttachments.Count > 0)
                 *      {
                 *          foreach (CSRAttachment CP in CPR.CSRAttachments)
                 *          {
                 *              OCRAttachment OPA = new OCRAttachment();
                 *              OPA.FilePath = CP.FilePath;
                 *              OPA.OperationalControlRequest = _presenter.CurrentOperationalControlRequest;
                 *              _presenter.CurrentOperationalControlRequest.OCRAttachments.Add(OPA);
                 *          }
                 *      }
                 *  }
                 * }*/
            }
        }
        private void PopulateBankPaymentDetail()
        {
            if (Request.QueryString["Page"] != null)
            {
                if (Request.QueryString["Page"].Contains("CashPayment"))
                {
                    if (Request.QueryString["PaymentId"] != null)
                    {
                        int paymentId          = Convert.ToInt32(Request.QueryString["PaymentId"]);
                        CashPaymentRequest CPR = _presenter.GetCashPaymentRequest(paymentId);
                        if (CPR != null)
                        {
                            _presenter.CurrentOperationalControlRequest.Description = CPR.Description;
                            _presenter.CurrentOperationalControlRequest.PaymentId   = paymentId;
                            _presenter.CurrentOperationalControlRequest.Supplier    = CPR.Supplier;
                            txtOriginalRequester.Text = CPR.AppUser.FullName;
                            txtDescription.Text       = CPR.Description;

                            foreach (CashPaymentRequestDetail CPRD in CPR.CashPaymentRequestDetails)
                            {
                                OperationalControlRequestDetail OCRD = new OperationalControlRequestDetail();
                                OCRD.ItemAccount      = CPRD.ItemAccount;
                                OCRD.Project          = CPRD.Project;
                                OCRD.Grant            = CPRD.Grant;
                                OCRD.Amount           = CPRD.Amount;
                                OCRD.ActualExpendture = CPRD.Amount;
                                OCRD.AccountCode      = CPRD.AccountCode;
                                _presenter.CurrentOperationalControlRequest.TotalAmount           += OCRD.Amount;
                                _presenter.CurrentOperationalControlRequest.TotalActualExpendture += OCRD.Amount;
                                OCRD.OperationalControlRequest = _presenter.CurrentOperationalControlRequest;
                                _presenter.CurrentOperationalControlRequest.OperationalControlRequestDetails.Add(OCRD);

                                if (CPRD.CPRAttachments.Count > 0)
                                {
                                    foreach (CPRAttachment CP in CPRD.CPRAttachments)
                                    {
                                        OCRAttachment OPA = new OCRAttachment();

                                        OPA.FilePath = CP.FilePath;
                                        OPA.OperationalControlRequest = _presenter.CurrentOperationalControlRequest;
                                        _presenter.CurrentOperationalControlRequest.OCRAttachments.Add(OPA);
                                    }
                                }
                            }
                        }
                    }
                }
                else if (Request.QueryString["Page"].Contains("TravelAdvance"))
                {
                    if (Request.QueryString["PaymentId"] != null)
                    {
                        int travelAdvId          = Convert.ToInt32(Request.QueryString["PaymentId"]);
                        TravelAdvanceRequest TAR = _presenter.GetTravelAdvanceRequest(travelAdvId);
                        if (TAR != null)
                        {
                            _presenter.CurrentOperationalControlRequest.Description     = TAR.PurposeOfTravel;
                            _presenter.CurrentOperationalControlRequest.TravelAdvanceId = travelAdvId;
                            txtOriginalRequester.Text = TAR.AppUser.FullName;
                            txtDescription.Text       = TAR.PurposeOfTravel;

                            foreach (TravelAdvanceRequestDetail TARD in TAR.TravelAdvanceRequestDetails)
                            {
                                foreach (TravelAdvanceCost TAC in TARD.TravelAdvanceCosts)
                                {
                                    OperationalControlRequestDetail OCRD = new OperationalControlRequestDetail();
                                    OCRD.ItemAccount      = TAC.ItemAccount;
                                    OCRD.AccountCode      = TAC.AccountCode;
                                    OCRD.Project          = TAR.Project;
                                    OCRD.Grant            = TAR.Grant;
                                    OCRD.Amount           = TAC.Total;
                                    OCRD.ActualExpendture = TAC.Total;
                                    _presenter.CurrentOperationalControlRequest.TotalAmount           += OCRD.Amount;
                                    _presenter.CurrentOperationalControlRequest.TotalActualExpendture += OCRD.Amount;
                                    OCRD.OperationalControlRequest = _presenter.CurrentOperationalControlRequest;
                                    _presenter.CurrentOperationalControlRequest.OperationalControlRequestDetails.Add(OCRD);
                                }
                            }
                        }
                    }
                }
                else if (Request.QueryString["Page"].Contains("ExpenseLiquidation"))
                {
                    if (Request.QueryString["PaymentId"] != null)
                    {
                        int liquidationId             = Convert.ToInt32(Request.QueryString["PaymentId"]);
                        ExpenseLiquidationRequest ELR = _presenter.GetExpenseLiquidation(liquidationId);
                        if (ELR != null)
                        {
                            _presenter.CurrentOperationalControlRequest.LiquidationId = liquidationId;
                            txtOriginalRequester.Text = ELR.TravelAdvanceRequest.AppUser.FullName;
                            txtDescription.Text       = ELR.AdditionalComment;

                            OperationalControlRequestDetail OCRD = new OperationalControlRequestDetail
                            {
                                Amount      = ELR.TotalActualExpenditure - ELR.TotalTravelAdvance,
                                ItemAccount = _presenter.GetDefaultItemAccount(),
                                Project     = ELR.ExpenseLiquidationRequestDetails[0].Project,
                                Grant       = ELR.ExpenseLiquidationRequestDetails[0].Grant
                            };

                            _presenter.CurrentOperationalControlRequest.TotalAmount           = OCRD.Amount;
                            _presenter.CurrentOperationalControlRequest.TotalActualExpendture = OCRD.Amount;
                            OCRD.OperationalControlRequest = _presenter.CurrentOperationalControlRequest;
                            _presenter.CurrentOperationalControlRequest.OperationalControlRequestDetails.Add(OCRD);
                        }
                    }
                }
                else if (Request.QueryString["Page"].Contains("Settlement"))
                {
                    if (Request.QueryString["SettlementId"] != null)
                    {
                        int SettlementId = Convert.ToInt32(Request.QueryString["SettlementId"]);
                        PaymentReimbursementRequest PRR = _presenter.GetReimbursementRequest(SettlementId);
                        if (PRR != null)
                        {
                            _presenter.CurrentOperationalControlRequest.Description  = PRR.Comment;
                            _presenter.CurrentOperationalControlRequest.SettlementId = SettlementId;
                            txtDescription.Text = PRR.Comment;

                            foreach (PaymentReimbursementRequestDetail detail in PRR.PaymentReimbursementRequestDetails)
                            {
                                OperationalControlRequestDetail OCRD = new OperationalControlRequestDetail();
                                OCRD.ItemAccount = PRR.CashPaymentRequest.CashPaymentRequestDetails[0].ItemAccount;//  detail.ItemAccount;
                                OCRD.Amount      = PRR.ReceivableAmount - PRR.TotalAmount;
                                OCRD.Project     = PRR.Project;
                                OCRD.Grant       = PRR.Grant;
                                _presenter.CurrentOperationalControlRequest.TotalAmount           = PRR.ReceivableAmount;
                                _presenter.CurrentOperationalControlRequest.TotalActualExpendture = PRR.TotalAmount;
                                OCRD.OperationalControlRequest = _presenter.CurrentOperationalControlRequest;
                                _presenter.CurrentOperationalControlRequest.OperationalControlRequestDetails.Add(OCRD);
                                if (detail.PRAttachments.Count > 0)
                                {
                                    foreach (PRAttachment CP in detail.PRAttachments)
                                    {
                                        OCRAttachment OPA = new OCRAttachment
                                        {
                                            FilePath = CP.FilePath,
                                            OperationalControlRequest = _presenter.CurrentOperationalControlRequest
                                        };
                                        _presenter.CurrentOperationalControlRequest.OCRAttachments.Add(OPA);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }