public void BindSimpleExpense(string expenseType, long userId, bool refreshHeader) { this.refreshHeaderGrid = refreshHeader; ExpenseRecommend recommand = new ExpenseRecommend(); recommand.UserID = userId; recommand.LanguageID = UserAccount.CurrentLanguageID; SuUser requester = QueryProvider.SuUserQuery.FindByIdentity(userId); if (requester != null) { CompanyIDRequester = requester.Company.CompanyID; } this.DocumentType = expenseType; if (expenseType.Equals(ZoneType.Domestic)) { recommand.IsDomesticRecommend = true; } else if (expenseType.Equals(ZoneType.Foreign)) { recommand.IsForegnRecommend = true; } ExpenseDataSet ds = (ExpenseDataSet)TransactionService.GetDS(this.TransactionId); ExpenseDataSet.FnExpenseDocumentRow expRow = ds.FnExpenseDocument.FindByExpenseID(ExpDocumentID); if (!expRow.IsLocalCurrencyIDNull()) { this.FinalCurrencyID = expRow.LocalCurrencyID; } ctlSimpleExpenseGridView.DataSource = ScgDbQueryProvider.DbAccountQuery.FindExpenseRecommendByExpenseGroup(recommand); ctlSimpleExpenseGridView.DataBind(); SetCurrentSimpleExpense(); ctlUpdateSimpleExpenseGridView.Update(); }
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; } }
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; } } }