protected void ctlAdvanceGridview_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Literal ctlNoLabel = e.Row.FindControl("ctlNoLabel") as Literal;

                ctlNoLabel.Text = ((ctlAdvanceGridView.PageSize * ctlAdvanceGridView.CustomPageIndex) + (e.Row.RowIndex + 1)).ToString();

                //Sum Amount(THB)
                Literal ctlLblAmount = (Literal)e.Row.FindControl("ctlLblAmount");
                //this.SumAdvanceAmount += UIHelper.ParseInt(ctlLblAmount.Text);
                //ctlTotalAdvanceAmount.Text = this.SumAdvanceAmount.ToString();
                if (InitialFlag.Equals(FlagEnum.ViewFlag))
                {
                    ((ImageButton)e.Row.FindControl("ctlDelete")).Visible = false;
                }

                SCG.eAccounting.DTO.ValueObject.Advance advance = e.Row.DataItem as SCG.eAccounting.DTO.ValueObject.Advance;

                if (!string.IsNullOrEmpty(this.AdvanceNoTemp) && !this.AdvanceNoTemp.Contains(advance.AdvanceNo))
                {
                    this.AdvanceNoTemp += ',' + advance.AdvanceNo;
                }
                else
                {
                    this.AdvanceNoTemp = advance.AdvanceNo;
                }
            }
        }
Ejemplo n.º 2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (obj == this)
            {
                return(true);
            }
            if (obj.GetType() != this.GetType())
            {
                return(false);
            }

            Advance castedObj = (Advance)obj;

            if (this.AdvanceID == castedObj.AdvanceID)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public void PrepareAdvance(IList <SCG.eAccounting.DTO.ValueObject.Advance> advanceList)
        {
            foreach (SCG.eAccounting.DTO.ValueObject.Advance advance in advanceList)
            {
                AvAdvanceDocument advanceDocument = ScgeAccountingQueryProvider.AvAdvanceDocumentQuery.FindProxyByIdentity(advance.AdvanceID);
                if (advanceDocument.TADocumentID != null && advanceDocument.TADocumentID != 0)
                {
                    // For query only advance that
                    // 1. Status = OutStanding
                    // 2. Do not used in Expense that has flag <> 'Cancel'
                    SCG.eAccounting.DTO.ValueObject.Advance avCriteria = new SCG.eAccounting.DTO.ValueObject.Advance();
                    avCriteria.CompanyID    = CompanyID;
                    avCriteria.RequesterID  = RequesterID;
                    avCriteria.AdvanceType  = FnExpenseDocumentService.GetExpenseType(this.ExpDocumentID, this.TransactionId);
                    advance.ExpenseType     = avCriteria.AdvanceType;
                    avCriteria.TADocumentID = advanceDocument.TADocumentID;

                    //Delete all advance and remittance in ExpenseAdvance Datatable.
                    //กรณีที่มีรายการ advance ที่อ้างอิง TA อยู่ใน advanceList ที่เลือกมา
                    this.ClearAdvanceGridview();
                    //this.ClearRemittanceGridview();

                    FnExpenseDocumentService.SetTA(this.TransactionId, this.ExpDocumentID, avCriteria);

                    TADocument ta = ScgeAccountingQueryProvider.TADocumentQuery.FindByIdentity(advanceDocument.TADocumentID.Value);
                    SS.Standard.WorkFlow.DTO.WorkFlow wf = SS.Standard.WorkFlow.Query.WorkFlowQueryProvider.WorkFlowQuery.GetWorkFlowByDocumentID(ta.DocumentID.DocumentID);

                    ctlTANoLabel.Visible          = false;
                    ctlTALinkButton.Text          = ta.DocumentID.DocumentNo;
                    ctlTALinkButton.OnClientClick = "window.open('../Programs/DocumentView.aspx?wfid=" + wf.WorkFlowID.ToString() + "')";
                    ctlBusinessChk.Checked        = ta.IsBusinessPurpose;
                    ctlTrainingChk.Checked        = ta.IsTrainningPurpose;
                    ctlOtherChk.Checked           = ta.IsOtherPurpose;
                    ctlOther.Text         = ta.OtherPurposeDescription;
                    ctlCountry.Text       = ta.Country;
                    ctlFromDateCal.Value  = ta.FromDate;
                    ctlToDateCal.Value    = ta.ToDate;
                    ctlAddAdvance.Enabled = false;

                    ctlAdvanceGridView.Columns[7].Visible = false;
                    ctlTANoLookup.Enabled = true;
                    ctlDeleteTA.Enabled   = true;

                    break;
                }
                else
                {
                    double totalAdvance = FnExpenseDocumentService.AddExpenseAdvanceToTransaction(this.TransactionId, this.ExpDocumentID, advanceList, 0);
                    FnExpenseDocumentService.SetTotalAdvance(this.TransactionId, 0, totalAdvance);
                    FnExpenseDocumentService.RefreshRemittance(this.TransactionId, this.ExpDocumentID);
                    //break;
                }
            }
        }
        protected void TA_OnObjectLookUpReturn(object sender, ObjectLookUpReturnArgs e)
        {
            ctlAddAdvance.Enabled = false;
            TADocumentObj TA = (TADocumentObj)e.ObjectReturn;

            ctlAdvanceGridView.Columns[5].Visible = false;

            // For query only advance that
            // 1. Status = OutStanding
            // 2. Do not used in Expense that has flag <> 'Cancel'
            SCG.eAccounting.DTO.ValueObject.Advance avCriteria = new SCG.eAccounting.DTO.ValueObject.Advance();
            avCriteria.CompanyID    = CompanyID;
            avCriteria.RequesterID  = RequesterID;
            avCriteria.AdvanceType  = FnExpenseDocumentService.GetExpenseType(this.ExpDocumentID, this.TransactionId);
            avCriteria.TADocumentID = TA.TADocumentID;

            FnExpenseDocumentService.SetTA(this.TransactionId, this.ExpDocumentID, avCriteria);

            if (TA.TADocumentID.HasValue)
            {
                ctlTANoLabel.Visible          = false;
                ctlTALinkButton.Text          = TA.DocumentNo;
                ctlTALinkButton.OnClientClick = "window.open('../Programs/DocumentView.aspx?wfid=" + TA.WorkflowID.ToString() + "')";
                ctlBusinessChk.Checked        = TA.IsBusinessPurpose == null ? false : bool.Parse(TA.IsBusinessPurpose.ToString());
                ctlTrainingChk.Checked        = TA.IsTrainningPurpose == null ? false : bool.Parse(TA.IsTrainningPurpose.ToString());
                ctlOtherChk.Checked           = TA.IsOtherPurpose == null ? false : bool.Parse(TA.IsOtherPurpose.ToString());
                ctlOther.Text            = TA.OtherPurposeDescription.ToString();
                ctlFromDateCal.DateValue = UIHelper.ToDateString(TA.FromDate);
                ctlToDateCal.DateValue   = UIHelper.ToDateString(TA.ToDate);
                ctlCountry.Text          = TA.Country;
            }
            else
            {
                ResetTADataZone();
            }
            this.BindAdvanceGridView();
            this.BindRemittanceGridview();
            ExpenseDocumentEditor.NotifyPaymentDetailChange();
            ctlUpdatePanelExpenseGeneral.Update();
        }