Exemplo n.º 1
0
        public void Initialize(Guid txID, long documentID, string initFlag)
        {
            this.TransactionId = txID;
            this.DocumentID    = documentID;
            this.InitialFlag   = initFlag;
            int    messageCode = 0;
            string message     = string.Empty;
            bool   boolVerify  = false;
            bool   boolVerifyAndApproveVerify = false;
            bool   boolApprove             = false;
            bool   boolApproveDocument     = false;
            bool   showWarningChangeAmount = false;

            long workFlowID = long.Parse(Request.QueryString["wfid"] == null ? "0" : Request.QueryString["wfid"].Trim());

            if (workFlowID > 0)
            {
                SS.Standard.WorkFlow.DTO.WorkFlow workflow = SS.Standard.WorkFlow.Query.WorkFlowQueryProvider.WorkFlowQuery.FindByIdentity(workFlowID);
                SS.Standard.WorkFlow.DTO.Document document = SS.Standard.WorkFlow.Query.WorkFlowQueryProvider.WorkFlowQuery.GetDocumentByWorkFlowID(workFlowID);

                if (document.DocumentType.DocumentTypeID == 1) //AdvanceDomesticDocument
                {
                    boolVerify = AdvanceWorkFlowService.CanVerifyWaitVerify(workFlowID);
                    boolVerifyAndApproveVerify = AdvanceWorkFlowService.CanVerifyAndApproveVerifyWaitVerify(workFlowID);
                    boolApprove         = AdvanceWorkFlowService.CanApproveWaitApproveVerify(workFlowID);
                    boolApproveDocument = AdvanceWorkFlowService.CanApproveWaitApprove(workFlowID);
                }
                else if (document.DocumentType.DocumentTypeID == 5) //AdvanceForeignDocument
                {
                    boolVerify = AdvanceForeignWorkFlowService.CanVerifyWaitVerify(workFlowID);
                    boolVerifyAndApproveVerify = AdvanceForeignWorkFlowService.CanVerifyAndApproveVerifyWaitVerify(workFlowID);
                    boolApprove         = AdvanceForeignWorkFlowService.CanApproveWaitApproveVerify(workFlowID);
                    boolApproveDocument = AdvanceForeignWorkFlowService.CanApproveWaitApprove(workFlowID);
                }
                else if (document.DocumentType.DocumentTypeID == 3 || document.DocumentType.DocumentTypeID == 7) //ExpenseDomesticDocument, ExpenseForeignDocument
                {
                    boolVerify = ExpenseWorkFlowService.CanVerifyWaitVerify(workFlowID);
                    boolVerifyAndApproveVerify = ExpenseWorkFlowService.CanVerifyAndApproveVerifyWaitVerify(workFlowID);
                    boolApprove         = ExpenseWorkFlowService.CanApproveWaitApproveVerify(workFlowID);
                    boolApproveDocument = ExpenseWorkFlowService.CanApproveWaitApprove(workFlowID);

                    if (workflow != null)
                    {
                        showWarningChangeAmount = workflow.CurrentState.Ordinal >= 6 && boolApprove;
                    }
                }
            }

            isSeeHistory          = ScgeAccountingQueryProvider.AvAdvanceDocumentQuery.isSeeHistoryReject(this.DocumentID);
            ctlSeeHistory.Visible = isSeeHistory;

            #region Warning message Requester and Approver is the same person
            if ((boolVerify || boolVerifyAndApproveVerify || boolApprove) && ((UserAccount.IsApproveVerifyDocument || UserAccount.IsVerifyDocument) || (UserAccount.IsApproveVerifyPayment || UserAccount.IsVerifyPayment)))
            {
                isSeeMessage = ScgeAccountingQueryProvider.AvAdvanceDocumentQuery.isSeeMessage(this.DocumentID);
                if (isSeeMessage)
                {
                    ctlSeeMessage.Visible = isSeeMessage;
                    messageCode           = ScgeAccountingQueryProvider.AvAdvanceDocumentQuery.isMessage(this.DocumentID);
                    if (UserAccount.CurrentLanguageID == 1)
                    {
                        if (messageCode == 1)
                        {
                            message = "และผู้เบิกค่าใช้จ่าย";
                        }
                        else if (messageCode == 2)
                        {
                            message = "และผู้รับเงิน";
                        }
                        else if (messageCode == 3)
                        {
                            message = ", ผู้เบิกค่าใช้จ่าย และผู้รับเงิน";
                        }
                    }
                    else if (UserAccount.CurrentLanguageID == 2)
                    {
                        if (messageCode == 1)
                        {
                            message = "and Requester";
                        }
                        else if (messageCode == 2)
                        {
                            message = "and Receiver";
                        }
                        else if (messageCode == 3)
                        {
                            message = ", Requester and Receiver";
                        }
                    }
                    this.ctlSeeMessage.Text = string.Format(this.GetProgramMessage("$SeeMessage$"), message);
                }
            }
            else
            {
                ctlSeeMessage.Visible = false;
            }
            #endregion
            ctlWarning.Visible = false;
            SCG.eAccounting.DTO.SCGDocument doc = ScgeAccountingQueryProvider.SCGDocumentQuery.FindByIdentity(DocumentID);
            if ((boolVerify || boolVerifyAndApproveVerify || boolApprove || boolApproveDocument) && ((UserAccount.UserID == doc.ApproverID.Userid || UserAccount.IsApproveVerifyDocument || UserAccount.IsVerifyDocument) || (UserAccount.IsApproveVerifyPayment || UserAccount.IsVerifyPayment)))
            {
                if (doc.RequesterID.Userid != doc.ReceiverID.Userid)
                {
                    ctlWarning.Visible = true;
                    ctlWarning.Text    = this.GetMessage("RequesterAndReceiverShouldBeTheSamePerson");
                }
            }

            ctlWarningChangeAmount.Visible = false;
            if (ParameterServices.EnableShowWarningMsgAmountHasBeenCorrected)
            {
                if (showWarningChangeAmount && UserAccount.IsApproveVerifyDocument)
                {
                    FnExpenseDocument expenseDocument = ScgeAccountingQueryProvider.FnExpenseDocumentQuery.GetExpenseDocumentByDocumentID(doc.DocumentID);
                    if (expenseDocument.AmountApproved != null && expenseDocument.TotalExpense != expenseDocument.AmountApproved)
                    {
                        ctlWarningChangeAmount.Visible = true;
                        ctlWarningChangeAmount.Text    = this.GetMessage("AmountHasBeenCorrected");
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the FnExpenseDocument class
 /// </summary>
 /// <param name="paymentType">Initial <see cref="FnExpenseDocument.PaymentType" /> value</param>
 /// <param name="totalExpense">Initial <see cref="FnExpenseDocument.TotalExpense" /> value</param>
 /// <param name="totalAdvance">Initial <see cref="FnExpenseDocument.TotalAdvance" /> value</param>
 /// <param name="active">Initial <see cref="FnExpenseDocument.Active" /> value</param>
 /// <param name="creBy">Initial <see cref="FnExpenseDocument.CreBy" /> value</param>
 /// <param name="creDate">Initial <see cref="FnExpenseDocument.CreDate" /> value</param>
 /// <param name="updBy">Initial <see cref="FnExpenseDocument.UpdBy" /> value</param>
 /// <param name="updDate">Initial <see cref="FnExpenseDocument.UpdDate" /> value</param>
 /// <param name="updPgm">Initial <see cref="FnExpenseDocument.UpdPgm" /> value</param>
 /// <param name="rowVersion">Initial <see cref="FnExpenseDocument.RowVersion" /> value</param>
 /// <param name="document">Initial <see cref="FnExpenseDocument.Document" /> value</param>
 /// <param name="serviceTeam">Initial <see cref="FnExpenseDocument.ServiceTeam" /> value</param>
 /// <param name="pB">Initial <see cref="FnExpenseDocument.PB" /> value</param>
 public FnExpenseDocument(string paymentType, double totalExpense, double totalAdvance, bool active, long creBy, DateTime creDate, long updBy, DateTime updDate, string updPgm, byte[] rowVersion, SCG.eAccounting.DTO.SCGDocument document, SCG.DB.DTO.DbServiceTeam serviceTeam, SCG.DB.DTO.Dbpb pB)
 {
     this.paymentType  = paymentType;
     this.totalExpense = totalExpense;
     this.totalAdvance = totalAdvance;
     this.active       = active;
     this.creBy        = creBy;
     this.creDate      = creDate;
     this.updBy        = updBy;
     this.updDate      = updDate;
     this.updPgm       = updPgm;
     this.rowVersion   = rowVersion;
     this.document     = document;
     this.serviceTeam  = serviceTeam;
     this.pB           = pB;
 }