Exemplo n.º 1
0
        public void SetCurrentSimpleExpense()
        {
            if (Session["CurrentRecommendExpense"] != null)
            {
                if (InitialFlag.Equals(FlagEnum.NewFlag) && IsRepOffice)
                {
                    IList <RecommendExpenseData> RecommendList = (IList <RecommendExpenseData>)Session["CurrentRecommendExpense"];

                    if (RecommendList.Count == ctlSimpleExpenseGridView.Rows.Count)
                    {
                        for (int i = 0; i < RecommendList.Count; i++)
                        {
                            GridViewRow row = ctlSimpleExpenseGridView.Rows[i];
                            UserControls.LOV.SCG.DB.CostCenterField      cost    = row.FindControl("ctlCostCenterLabelLookup") as UserControls.LOV.SCG.DB.CostCenterField;
                            UserControls.LOV.SCG.DB.AccountField         account = row.FindControl("ctlAccountLabelLookup") as UserControls.LOV.SCG.DB.AccountField;
                            UserControls.LOV.SCG.DB.IOAutoCompleteLookup io      = row.FindControl("ctlIOLabelLookup") as UserControls.LOV.SCG.DB.IOAutoCompleteLookup;
                            TextBox des       = row.FindControl("ctlTxtDescription") as TextBox;
                            TextBox amount    = row.FindControl("ctlTxtCurrencyAmount") as TextBox;
                            TextBox reference = row.FindControl("ctlTxtRefNo") as TextBox;

                            cost.BindCostCenterControl(UIHelper.ParseLong(RecommendList[i].CostCenterID));
                            account.BindAccountControl(UIHelper.ParseLong(RecommendList[i].ExpenseID));
                            io.BindIOControl(UIHelper.ParseLong(RecommendList[i].InternalID));
                            des.Text       = RecommendList[i].Description;
                            amount.Text    = RecommendList[i].Amount;
                            reference.Text = RecommendList[i].RefNo;
                        }
                    }
                }
            }
        }
        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;
                }
            }
        }
        public void BindControl(bool refreshHeader)
        {
            this.refreshHeaderGrid = refreshHeader;
            if (!InitialFlag.Equals(FlagEnum.NewFlag))
            {
                ctlExpenseItemGrid.DataCountAndBind();
                ctlDivTotal.Visible   = true;
                ctlDivSummary.Visible = true;
                BindSummary();
            }
            else
            {
                this.refreshHeaderGrid = false;
                ctlDivTotal.Visible    = false;
                ctlDivSummary.Visible  = false;
            }


            if (RequestCount() > 0)
            {
                IsEmptyData = false;
            }
            else
            {
                IsEmptyData = true;
            }

            ctlUpdatePanelViewByAccount.Update();
        }
Exemplo n.º 4
0
        protected void ctlExpeseMPAGridView_DataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Literal ctlNoLabel = e.Row.FindControl("ctlNoLabel") as Literal;

                ctlNoLabel.Text = ((ctlExpeseMPAGridView.PageSize * ctlExpeseMPAGridView.CustomPageIndex) + (e.Row.RowIndex + 1)).ToString();
                if (InitialFlag.Equals(FlagEnum.ViewFlag))
                {
                    ((ImageButton)e.Row.FindControl("ctlDelete")).Visible = false;
                }
            }
        }
Exemplo n.º 5
0
 public void BindControl(bool refreshHeader)
 {
     this.refreshHeaderGrid = refreshHeader;
     if (InitialFlag.Equals(FlagEnum.ViewFlag))
     {
         ctlAddExpenseMPA.Visible = false;
         ctlExpeseMPAGridView.Columns[4].Visible = false;
     }
     else
     {
         ctlAddExpenseMPA.Visible = true;
         ctlExpeseMPAGridView.Columns[4].Visible = true;
     }
     BindExpenseMPAGridView();
     ctlUpdatePanelExpenseGeneral.Update();
 }
        public void Initialize(Guid txID, long documentID, string initFlag)
        {
            this.TransactionId                   = txID;
            this.ExpDocumentID                   = documentID;
            this.InitialFlag                     = initFlag;
            ctlPaymentDetailTable.Width          = this.width;
            ctlMsgSummary.Text                   = GetProgramMessage("$DiffentialAmount$");
            ctlLblDifferenceAmtLocal.Text        = GetProgramMessage("$DiffentialAmount$");
            ctlLblDifferenceAmtMainCurrency.Text = GetProgramMessage("$DiffentialAmount$");
            ctlLblDifferenceAmtTHB.Text          = GetProgramMessage("$DiffentialAmount$");

            if (InitialFlag.Equals(FlagEnum.NewFlag))
            {
                ctlTotalAdvance.Visible     = false;
                ctlLblTotalAdvance.Visible  = false;
                ctlTotalRemitted.Visible    = false;
                ctlRemitted.Visible         = false;
                ctlMsgSummary.Text          = string.Empty;
                ctlDifferenceAmount.Visible = false;

                ctlTotalAdvanceLocal.Visible       = false;
                ctlLblTotalAdvanceLocal.Visible    = false;
                ctlTotalRemittanceLocal.Visible    = false;
                ctlLblTotalRemittanceLocal.Visible = false;
                ctlLblDifferenceAmtLocal.Text      = string.Empty;
                ctlDifferenceAmtLocal.Visible      = false;

                ctlTotalAdvanceMainCurrency.Visible       = false;
                ctlLblTotalAdvanceMainCurrency.Visible    = false;
                ctlTotalRemittanceMainCurrency.Visible    = false;
                ctlLblTotalRemittanceMainCurrency.Visible = false;
                ctlLblDifferenceAmtMainCurrency.Text      = string.Empty;
                ctlDifferenceAmtMainCurrency.Visible      = false;

                ctlTotalAdvanceTHB.Visible       = false;
                ctlLblTotalAdvanceTHB.Visible    = false;
                ctlTotalRemittanceTHB.Visible    = false;
                ctlLblTotalRemittanceTHB.Visible = false;
                ctlLblDifferenceAmtTHB.Text      = string.Empty;
                ctlDifferenceAmtTHB.Visible      = false;
            }
            else
            {
                this.UpdateMessageSummary();
            }
        }
Exemplo n.º 7
0
        protected void ctlRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            string url = string.Empty;

            if (e.Item.DataItem != null)
            {
                ExpenseDataSet expDs = (ExpenseDataSet)TransactionService.GetDS(TransactionId);
                ExpenseDataSet.FnExpenseInvoiceRow  invoice            = (ExpenseDataSet.FnExpenseInvoiceRow)e.Item.DataItem;
                ExpenseDataSet.FnExpenseDocumentRow expenseDocumentRow = expDs.FnExpenseDocument.FindByExpenseID(this.ExpDocumentID);

                PopupCaller popupEdit       = (PopupCaller)e.Item.FindControl("ctlEditPopupCaller");
                PopupCaller popupView       = (PopupCaller)e.Item.FindControl("ctlViewPopupCaller");
                LinkButton  edit            = (LinkButton)e.Item.FindControl("ctlEdit");
                LinkButton  delete          = (LinkButton)e.Item.FindControl("ctlDelete");
                LinkButton  view            = (LinkButton)e.Item.FindControl("ctlView");
                Literal     totalBaseAmount = (Literal)e.Item.FindControl("ctlTotalAmount");
                Literal     totalNetAmount  = (Literal)e.Item.FindControl("ctlNetAmount");

                if (IsRepOffice)
                {
                    totalBaseAmount.Text = UIHelper.BindDecimal(invoice.TotalBaseAmountLocalCurrency.ToString());
                    totalNetAmount.Text  = UIHelper.BindDecimal(invoice.NetAmountLocalCurrency.ToString());
                }
                else
                {
                    totalBaseAmount.Text = UIHelper.BindDecimal(invoice.TotalBaseAmount.ToString());
                    totalNetAmount.Text  = UIHelper.BindDecimal(invoice.NetAmount.ToString());
                }

                if (!invoice.IsInvoiceDocumentTypeNull() && invoice.InvoiceDocumentType.Equals(InvoiceType.Perdiem))
                {
                    popupEdit.URL = ShowPerdiemPopup(FlagEnum.EditFlag, invoice.InvoiceID);
                    popupView.URL = ShowPerdiemPopup(FlagEnum.ViewFlag, invoice.InvoiceID);
                }
                if (!invoice.IsInvoiceDocumentTypeNull() && invoice.InvoiceDocumentType.Equals(InvoiceType.General))
                {
                    url           = ShowExpenseGeneral(invoice.InvoiceID);
                    popupEdit.URL = url.Replace("[mode]", FlagEnum.EditFlag);
                    popupView.URL = url.Replace("[mode]", FlagEnum.ViewFlag);
                }

                // Show Mileage.
                if (!invoice.IsInvoiceDocumentTypeNull() && invoice.InvoiceDocumentType.Equals(InvoiceType.Mileage))
                {
                    popupEdit.URL = ShowMileagePopup(FlagEnum.EditFlag);
                    popupView.URL = ShowMileagePopup(FlagEnum.ViewFlag);
                }

                SS.Standard.WorkFlow.DTO.WorkFlow workflow = SS.Standard.WorkFlow.Query.WorkFlowQueryProvider.WorkFlowQuery.GetWorkFlowByDocumentID(this.DocumentID);

                if (InitialFlag.Equals(FlagEnum.ViewFlag))
                {
                    edit.Visible   = false;
                    delete.Visible = false;
                    view.Visible   = true;
                }
                else
                {
                    edit.Visible = true;
                    view.Visible = false;

                    if (!invoice.IsInvoiceDocumentTypeNull() && invoice.InvoiceDocumentType.Equals(InvoiceType.Mileage))
                    {
                        delete.Visible = false;
                    }
                    else
                    if (workflow != null && workflow.CurrentState.Name.Equals(WorkFlowStateFlag.Hold))
                    {
                        delete.Visible = false;
                    }
                    else
                    {
                        delete.Visible = true;
                    }
                }

                Literal seq = (Literal)e.Item.FindControl("ctlSeq");

                seq.Text += e.Item.ItemIndex + 1;

                BaseGridView gridview = (BaseGridView)e.Item.FindControl("ctlInvoiceItem");

                string filter = String.Format("InvoiceID = {0}", invoice.InvoiceID);
                gridview.DataSource = expDs.FnExpenseInvoiceItem.Select(filter);
                gridview.DataBind();
            }
        }
Exemplo n.º 8
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;
                }
            }
        }
Exemplo n.º 9
0
        protected void ctlSimpleExpenseGridView_RowDatabound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                UserControls.Dropdownlist.SS.DB.CurrencyDropdown currencyDropdown = e.Row.FindControl("ctlCurrencyDropdown") as UserControls.Dropdownlist.SS.DB.CurrencyDropdown;
                currencyDropdown.GridViewRowIndex = e.Row.RowIndex;
                currencyDropdown.BindCurrency(ParameterServices.USDCurrencyID);
                UserControls.LOV.SCG.DB.CostCenterField      cost    = e.Row.FindControl("ctlCostCenterLabelLookup") as UserControls.LOV.SCG.DB.CostCenterField;
                UserControls.LOV.SCG.DB.AccountField         account = e.Row.FindControl("ctlAccountLabelLookup") as UserControls.LOV.SCG.DB.AccountField;
                UserControls.LOV.SCG.DB.IOAutoCompleteLookup io      = e.Row.FindControl("ctlIOLabelLookup") as UserControls.LOV.SCG.DB.IOAutoCompleteLookup;
                HiddenField costId    = e.Row.FindControl("ctlCostCenter") as HiddenField;
                HiddenField accountId = e.Row.FindControl("ctlAccountID") as HiddenField;

                if (CompanyIDRequester == CompanyID)
                {
                    cost.BindCostCenterControl(UIHelper.ParseLong(costId.Value));
                }
                cost.CompanyId             = CompanyID;
                io.CompanyId               = CompanyID;
                cost.AccountFieldControlID = account.ID;
                cost.IOFieldControlID      = io.ID;

                account.WithoutExpenseCode = ParameterServices.AccountMileageExtra + "," + ParameterServices.AccountPerdiem;
                account.BindAccountControl(UIHelper.ParseLong(accountId.Value));
                if (cost.CostCenterId != "")
                {
                    io.CostCenterId = UIHelper.ParseLong(cost.CostCenterId);
                }

                account.CompanyIDofDocument = CompanyID;

                TextBox amount         = e.Row.FindControl("ctlTxtAmountTHB") as TextBox;
                TextBox currencyAmount = e.Row.FindControl("ctlTxtCurrencyAmount") as TextBox;
                TextBox exchangeRate   = e.Row.FindControl("ctlTxtExchangeRate") as TextBox;

                if (this.DocumentType.Equals(ZoneType.Foreign))
                {
                    currencyAmount.Attributes.Remove("onblur");
                    exchangeRate.Attributes.Remove("onblur");
                    currencyAmount.Attributes.Add("onblur", string.Format("calAmountTHB({0}, {1}, {2});", currencyAmount.ClientID, exchangeRate.ClientID, amount.ClientID));
                    exchangeRate.Attributes.Add("onblur", string.Format("calAmountTHB({0}, {1}, {2});", currencyAmount.ClientID, exchangeRate.ClientID, amount.ClientID));
                }
                else
                {
                    amount.ReadOnly = false;
                }

                if (InitialFlag.Equals(FlagEnum.NewFlag))
                {
                    TextBox des       = e.Row.FindControl("ctlTxtDescription") as TextBox;
                    TextBox reference = e.Row.FindControl("ctlTxtRefNo") as TextBox;

                    des.Text            = string.Empty;
                    amount.Text         = string.Empty;
                    reference.Text      = string.Empty;
                    currencyAmount.Text = string.Empty;
                    exchangeRate.Text   = string.Empty;
                    if (IsRepOffice)
                    {
                        if (this.DocumentType.Equals(ZoneType.Foreign))
                        {
                            if (this.FinalCurrencyID == UIHelper.ParseShort(currencyDropdown.SelectedValue))
                            {
                                exchangeRate.Text = UIHelper.BindExchangeRate("1");
                            }
                        }
                    }
                }
            }
        }
        public void BindControl(bool refreshHeader)
        {
            this.refreshHeaderGrid = refreshHeader;
            if (InitialFlag.Equals(FlagEnum.ViewFlag))
            {
                ctlAddAdvance.Enabled = false;
                ctlTANoLookup.Visible = false;
                ctlDeleteTA.Visible   = false;
            }
            else
            {
                ctlAddAdvance.Enabled = true;
                ctlTANoLookup.Visible = true;
                ctlDeleteTA.Visible   = true;
            }

            if (this.DocumentType.Equals(ZoneType.Domestic))
            {
                this.IsDomestic = true;
                ctlRemittanceGridview.Visible = false;
                ctlTALookup.TravelBy          = TravellBy.Domestic;
                ctlControlPanel.Visible       = false;
            }
            else
            {
                this.IsDomestic = false;
                ctlRemittanceGridview.Visible = true;
                ctlTALookup.TravelBy          = TravellBy.Foreign;
                ctlControlPanel.Visible       = true;
            }

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

            ExpenseDataSet.FnExpenseDocumentRow row = expenseDS.FnExpenseDocument.FindByExpenseID(this.ExpDocumentID);
            if (!row.IsTADocumentIDNull())
            {
                ctlTANoLookup.Enabled = false;
                TADocument ta = ScgeAccountingQueryProvider.TADocumentQuery.FindByIdentity(row.TADocumentID);
                SS.Standard.WorkFlow.DTO.WorkFlow wf = SS.Standard.WorkFlow.Query.WorkFlowQueryProvider.WorkFlowQuery.GetWorkFlowByDocumentID(ta.DocumentID.DocumentID);
                ctlAddAdvance.Enabled         = false;
                ctlTANoLabel.Visible          = false;
                ctlTALinkButton.Text          = ta.DocumentID.DocumentNo;
                ctlTALinkButton.OnClientClick = "window.open('../Programs/DocumentView.aspx?wfid=" + wf.WorkFlowID.ToString() + "')";
                ctlBusinessChk.Checked        = !(row.IsIsBusinessPurposeNull() || row.IsBusinessPurpose == false);
                ctlTrainingChk.Checked        = !(row.IsIsTrainningPurposeNull() || row.IsTrainningPurpose == false);
                ctlOtherChk.Checked           = !(row.IsIsOtherPurposeNull() || row.IsOtherPurpose == false);
                ctlOther.Text   = row.IsOtherPurposeDescriptionNull() ? String.Empty : row.OtherPurposeDescription;
                ctlCountry.Text = row.IsCountryNull() ? String.Empty : row.Country;

                if (!row.IsFromDateNull())
                {
                    ctlFromDateCal.Value = row.FromDate;
                }
                if (!row.IsToDateNull())
                {
                    ctlToDateCal.Value = row.ToDate;
                }

                ctlPersonLevel.Text            = row.IsPersonalLevelNull() ? String.Empty : row.PersonalLevel;
                ctlExchangeRateForPerdiem.Text = row.IsExchangeRateForUSDAdvanceNull() ? String.Empty : row.ExchangeRateForUSDAdvance.ToString();
            }
            else
            {
                ResetTADataZone();
                if (expenseDS.FnExpenseAdvance.Rows.Count > 0)
                {
                    ctlTANoLookup.Enabled = false;
                    ctlDeleteTA.Enabled   = false;
                }
            }

            BindAdvanceGridView();
            BindRemittanceGridview();
            ctlUpdatePanelExpenseGeneral.Update();
        }