protected void ctlRemittanceGridview_DataBound(object sender, EventArgs e)
        {
            ExpenseDataSet expenseDS = (ExpenseDataSet)TransactionService.GetDS(this.TransactionId);

            ExpenseDataSet.FnExpenseDocumentRow row = expenseDS.FnExpenseDocument.FindByExpenseID(this.ExpDocumentID);
            SS.Standard.WorkFlow.DTO.WorkFlow   wf  = null;
            int Ordinal = 0;

            if (Request["wfid"] != null)
            {
                WorkFlowID   = UIHelper.ParseLong(Request["wfid"].ToString());
                wf           = WorkFlowQueryProvider.WorkFlowQuery.FindByIdentity(WorkFlowID);
                CurrentState = wf.CurrentState.Name;
                Ordinal      = wf.CurrentState.Ordinal;
            }
            DbCurrency mainCurrency = null;

            if (!row.IsMainCurrencyIDNull())
            {
                mainCurrency = SsDbQueryProvider.DbCurrencyQuery.FindByIdentity(row.MainCurrencyID);
            }
            if (mainCurrency != null)
            {
                ctlRemittanceGridview.Columns[7].HeaderText = string.Format(GetProgramMessage("ctlLblRemittanceMainAmount"), "(" + mainCurrency.Symbol + ")");
            }

            string expenseType = FnExpenseDocumentService.GetExpenseType(this.ExpDocumentID, this.TransactionId);
            bool   isRepOffice = row.IsIsRepOfficeNull() ? false : row.IsRepOffice;

            if (!expenseType.Equals(ZoneType.Domestic))
            {
                if (isRepOffice)
                {
                    if (CurrentState.Equals(WorkFlowStateFlag.WaitVerify) || Ordinal > 5)
                    {
                        ctlRemittanceGridview.Columns[7].Visible = true;
                        ctlRemittanceGridview.Columns[8].Visible = true;
                    }
                    else
                    {
                        ctlRemittanceGridview.Columns[7].Visible = true;
                        ctlRemittanceGridview.Columns[8].Visible = false;
                    }
                }
                else
                {
                    ctlRemittanceGridview.Columns[7].Visible = false;
                    ctlRemittanceGridview.Columns[8].Visible = true;
                }
            }
        }
        protected void Advance_OnObjectLookUpCalling(object sender, ObjectLookUpCallingEventArgs e)
        {
            UserControls.LOV.AV.AdvanceLookup advanceLookUp = sender as UserControls.LOV.AV.AdvanceLookup;
            ExpenseDataSet expenseDS = (ExpenseDataSet)TransactionService.GetDS(this.TransactionId);

            ExpenseDataSet.FnExpenseDocumentRow row = expenseDS.FnExpenseDocument.FindByExpenseID(this.ExpDocumentID);

            if (!row.IsMainCurrencyIDNull())
            {
                this.MainCurrencyID = row.MainCurrencyID;
            }

            if (!row.IsPBIDNull())
            {
                this.PBID = row.PBID;
            }

            this.IsRepOffice = row.IsIsRepOfficeNull() ? false : row.IsRepOffice;

            advanceLookUp.CompanyID   = CompanyID;   // UIHelper.ParseLong(((LOV.SCG.DB.CompanyField)this.Parent.Parent.Parent.Parent.FindControl("ctlCompanyField")).CompanyID);
            advanceLookUp.RequesterID = RequesterID; // UIHelper.ParseLong(((ActorData)this.Parent.Parent.Parent.Parent.FindControl("ctlRequesterData")).UserID);
            advanceLookUp.AdvanceType = FnExpenseDocumentService.GetExpenseType(this.ExpDocumentID, this.TransactionId);
            advanceLookUp.IsRelateWithRemittanceButNotInExpense = true;
            advanceLookUp.PBID           = this.PBID;
            advanceLookUp.MainCurrencyID = this.MainCurrencyID;
            advanceLookUp.IsRepOffice    = this.IsRepOffice;
            if (!string.IsNullOrEmpty(Request.Params["wfid"]) && UIHelper.ParseInt(Request.Params["wfid"]) > 0)
            {
                long workFlowID = UIHelper.ParseLong(Request.Params["wfid"]);

                SS.Standard.WorkFlow.DTO.WorkFlow wf = WorkFlowQueryProvider.WorkFlowQuery.FindByIdentity(workFlowID);
                if (wf != null && wf.CurrentState != null && wf.CurrentState.Name != null && wf.CurrentState.Name.Equals(WorkFlowStateFlag.Draft))
                {
                    advanceLookUp.CurrentUserID = UserAccount.UserID;
                }
            }
            else
            {
                advanceLookUp.CurrentUserID = UserAccount.UserID;
            }
        }
示例#3
0
        protected void ctlInvoiceItem_DataBound(object sender, EventArgs e)
        {
            BaseGridView gridview = (BaseGridView)sender;

            if (DocumentType.Equals(ZoneType.Domestic))
            {
                gridview.Columns[5].Visible = false;
                gridview.Columns[4].Visible = false;
                gridview.Columns[6].Visible = false;
            }
            else
            {
                gridview.Columns[5].Visible = true;
                gridview.Columns[4].Visible = true;
                gridview.Columns[6].Visible = true;
            }

            if (IsRepOffice)
            {
                SS.Standard.WorkFlow.DTO.WorkFlow workflow = null;
                if (!string.IsNullOrEmpty(Request.Params["wfid"]) && UIHelper.ParseInt(Request.Params["wfid"]) > 0)
                {
                    long workFlowID = UIHelper.ParseLong(Request.Params["wfid"]);

                    try
                    {
                        workflow = WorkFlowQueryProvider.WorkFlowQuery.FindByIdentity(workFlowID);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }

                gridview.Columns[7].Visible    = true; //local currency
                gridview.Columns[7].HeaderText = string.Format(GetMessage("AmountCurrencyHeaderColumn"), "(" + SelectedCurrency + ")");

                ExpenseDataSet expDs = (ExpenseDataSet)TransactionService.GetDS(TransactionId);

                ExpenseDataSet.FnExpenseDocumentRow expRow = expDs.FnExpenseDocument.FindByExpenseID(this.ExpDocumentID);
                if (!expRow.IsMainCurrencyIDNull())
                {
                    DbCurrency mainCurrency = SsDbQueryProvider.DbCurrencyQuery.FindByIdentity(expRow.MainCurrencyID);
                    if (mainCurrency != null)
                    {
                        gridview.Columns[8].HeaderText = string.Format(GetMessage("AmountCurrencyHeaderColumn"), "(" + mainCurrency.Symbol + ")");
                    }
                }

                if ((workflow != null && workflow.CurrentState.Ordinal >= 5) && (UserAccount.IsAccountant || UserAccount.IsPayment))
                {
                    if (!expRow.IsMainCurrencyIDNull() && !expRow.IsLocalCurrencyIDNull() && (expRow.MainCurrencyID == expRow.LocalCurrencyID))
                    {
                        gridview.Columns[8].Visible = false;  //hide main currency
                    }
                    else
                    {
                        gridview.Columns[8].Visible = true; //show main currency
                    }
                    gridview.Columns[9].Visible = true;     //THB
                }
                else
                {
                    gridview.Columns[8].Visible = false;
                    gridview.Columns[9].Visible = false;
                }
            }
            else
            {
                gridview.Columns[7].Visible = false;
                gridview.Columns[8].Visible = false;
                gridview.Columns[9].Visible = true;
            }
        }
示例#4
0
        public void BindControl()
        {
            SS.Standard.WorkFlow.DTO.WorkFlow workflow = null;
            long workFlowID = 0;

            if (!string.IsNullOrEmpty(Request.Params["wfid"]) && UIHelper.ParseInt(Request.Params["wfid"]) > 0)
            {
                workFlowID = UIHelper.ParseLong(Request.Params["wfid"]);
                workflow   = WorkFlowQueryProvider.WorkFlowQuery.FindByIdentity(workFlowID);
            }

            if (DocumentType.Equals(ZoneType.Foreign) || this.IsRepOffice)
            {
                ctlAddMilage.Style["display"] = "none";
            }
            else
            {
                ctlAddMilage.Style["display"] = string.Empty;
            }

            if (!InitialFlag.Equals(FlagEnum.ViewFlag) && (workflow == null || (workflow != null && !workflow.CurrentState.Name.Equals(WorkFlowStateFlag.Hold))))
            {
                ctlAddGeneralExpense.Enabled = true;
                ctlAddPerdiem.Enabled        = true;
                ctlAddMilage.Enabled         = true;
            }
            else
            {
                ctlAddGeneralExpense.Enabled = false;
                ctlAddPerdiem.Enabled        = false;
                ctlAddMilage.Enabled         = false;
            }
            ctlSimpleExpense.DocumentType = this.DocumentType;
            ctlPerdiemPopupCaller.URL     = ShowPerdiemPopup(InitialFlag, null);
            ctlInvoicePopupCaller.URL     = String.Format(invoiceURL.Replace("[mode]", FlagEnum.NewFlag), this.TransactionId, this.ExpDocumentID, this.DocumentType, this.DocumentID, string.Empty);
            ctlMileagePopupCaller.URL     = ShowMileagePopup(InitialFlag);

            ExpenseDataSet expDs = (ExpenseDataSet)TransactionService.GetDS(this.TransactionId);

            ExpenseDataSet.FnExpenseDocumentRow expenseDocumentRow = expDs.FnExpenseDocument.FindByExpenseID(this.ExpDocumentID);
            this.DocumentID = expenseDocumentRow.DocumentID;

            ctlDivExchangeRateLocalInfo.Style["display"] = "none";
            ctlDivExchangeRateMainInfo.Style["display"]  = "none";

            if (!InitialFlag.Equals(FlagEnum.NewFlag) && IsRepOffice)
            {
                try
                {
                    if ((workflow != null && workflow.CurrentState.Ordinal >= 5) && (UserAccount.IsAccountant || UserAccount.IsPayment))
                    {
                        string mainCurrencySymbol  = string.Empty;
                        string localCurrencySymbol = string.Empty;
                        if (!expenseDocumentRow.IsLocalCurrencyIDNull())
                        {
                            DbCurrency localCurrency = SsDbQueryProvider.DbCurrencyQuery.FindByIdentity(expenseDocumentRow.LocalCurrencyID);
                            localCurrencySymbol = localCurrency.Symbol;
                        }

                        if (!expenseDocumentRow.IsMainCurrencyIDNull())
                        {
                            DbCurrency mainCurrency = SsDbQueryProvider.DbCurrencyQuery.FindByIdentity(expenseDocumentRow.MainCurrencyID);
                            mainCurrencySymbol = mainCurrency.Symbol;
                        }

                        ctlExRateMainCurrencyLabel.Text = GetProgramMessage("DisplayExchangeRateInfo");
                        ctlExchangeRateMain.Text        = UIHelper.BindExchangeRate(expenseDocumentRow.IsExchangeRateMainToTHBCurrencyNull() ? string.Empty : expenseDocumentRow.ExchangeRateMainToTHBCurrency.ToString());
                        ctlExchangeRateMainUnit.Text    = CurrencySymbol.THB + "/" + mainCurrencySymbol;

                        ctlExRateLocalCurrencyLabel.Text = GetProgramMessage("DisplayExchangeRateInfo");
                        ctlExchangeRateLocal.Text        = UIHelper.BindExchangeRate(expenseDocumentRow.IsExchangeRateForLocalCurrencyNull() ? string.Empty : expenseDocumentRow.ExchangeRateForLocalCurrency.ToString());
                        ctlExchangeRateLocalUnit.Text    = localCurrencySymbol + "/" + mainCurrencySymbol;

                        ctlDivExchangeRateMainInfo.Style["display"] = "block";
                        if (!expenseDocumentRow.IsMainCurrencyIDNull() && !expenseDocumentRow.IsLocalCurrencyIDNull() && (expenseDocumentRow.MainCurrencyID != expenseDocumentRow.LocalCurrencyID))
                        {
                            ctlDivExchangeRateLocalInfo.Style["display"] = "block";
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        protected void ctlAdvanceGridview_DataBound(object sender, EventArgs e)
        {
            ExpenseDataSet expenseDS = (ExpenseDataSet)TransactionService.GetDS(this.TransactionId);

            if (expenseDS != null)
            {
                ExpenseDataSet.FnExpenseDocumentRow row = expenseDS.FnExpenseDocument.FindByExpenseID(this.ExpDocumentID);
                SS.Standard.WorkFlow.DTO.WorkFlow   wf  = null;
                int Ordinal = 0;
                if (Request["wfid"] != null)
                {
                    WorkFlowID   = UIHelper.ParseLong(Request["wfid"].ToString());
                    wf           = WorkFlowQueryProvider.WorkFlowQuery.FindByIdentity(WorkFlowID);
                    CurrentState = wf.CurrentState.Name;
                    Ordinal      = wf.CurrentState.Ordinal;
                }
                //DbCurrency localCurrency = null;
                DbCurrency mainCurrency = null;
                //if (!row.IsLocalCurrencyIDNull())
                //{
                //    localCurrency = SsDbQueryProvider.DbCurrencyQuery.FindByIdentity(row.LocalCurrencyID);
                //}
                if (!row.IsMainCurrencyIDNull())
                {
                    mainCurrency = SsDbQueryProvider.DbCurrencyQuery.FindByIdentity(row.MainCurrencyID);
                }
                //if (localCurrency != null)
                //{
                //    ctlAdvanceGridView.Columns[4].HeaderText = string.Format(GetMessage("AmountCurrencyHeaderColumn"), "(" + localCurrency.Symbol + ")");
                //}
                //else
                //{
                ctlAdvanceGridView.Columns[4].HeaderText = string.Format(GetMessage("AmountCurrencyHeaderColumn"), "");
                //}

                if (mainCurrency != null)
                {
                    ctlAdvanceGridView.Columns[5].HeaderText   = string.Format(GetMessage("AmountCurrencyHeaderColumn"), "(" + mainCurrency.Symbol + ")");
                    ctlAdvanceGridView.HeaderRow.Cells[5].Text = string.Format(GetMessage("AmountCurrencyHeaderColumn"), "(" + mainCurrency.Symbol + ")");
                }
                else
                {
                    ctlAdvanceGridView.Columns[5].HeaderText = string.Format(GetMessage("AmountCurrencyHeaderColumn"), "");
                }

                string expenseType = FnExpenseDocumentService.GetExpenseType(this.ExpDocumentID, this.TransactionId);
                bool   isRepOffice = row.IsIsRepOfficeNull() ? false : row.IsRepOffice;

                if (expenseType.Equals(ZoneType.Domestic))
                {
                    if (isRepOffice)
                    {
                        if (CurrentState.Equals(WorkFlowStateFlag.WaitVerify) || Ordinal > 5)
                        {
                            ctlAdvanceGridView.Columns[4].Visible = false;
                            ctlAdvanceGridView.Columns[5].Visible = true;
                            ctlAdvanceGridView.Columns[6].Visible = true;
                        }
                        else
                        {
                            ctlAdvanceGridView.Columns[4].Visible = false;
                            ctlAdvanceGridView.Columns[5].Visible = true;
                            ctlAdvanceGridView.Columns[6].Visible = false;
                        }
                    }
                    else
                    {
                        ctlAdvanceGridView.Columns[4].Visible = false;
                        ctlAdvanceGridView.Columns[5].Visible = false;
                        ctlAdvanceGridView.Columns[6].Visible = true;
                    }
                }
                else
                {
                    if (isRepOffice)
                    {
                        if (CurrentState.Equals(WorkFlowStateFlag.WaitVerify) || Ordinal > 5)
                        {
                            ctlAdvanceGridView.Columns[4].Visible = false;
                            ctlAdvanceGridView.Columns[5].Visible = true;
                            ctlAdvanceGridView.Columns[6].Visible = true;
                        }
                        else
                        {
                            ctlAdvanceGridView.Columns[4].Visible = false;
                            ctlAdvanceGridView.Columns[5].Visible = true;
                            ctlAdvanceGridView.Columns[6].Visible = false;
                        }
                    }
                    else
                    {
                        ctlAdvanceGridView.Columns[4].Visible = false;
                        ctlAdvanceGridView.Columns[5].Visible = false;
                        ctlAdvanceGridView.Columns[6].Visible = true;
                    }
                }
            }

            if (ctlAdvanceGridView.Rows.Count == 0)
            {
                ctlTANoLookup.Enabled = true;
                ctlDeleteTA.Enabled   = true;
                //this.ClearRemittanceGridview();
            }
        }