protected void gridHandPosting_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            int idFondMoveDetails = Convert.ToInt32(Session["IdFondMoveDetailInEditorNma"]);

            var fondMoveActions = new FondMoveActions();
            var fondMove = fondMoveActions.GetFondMove(idFondMoveDetails);

            int? idFondMove = null;
            if (fondMove != null)
                idFondMove = fondMove.IdFondMove;

            int month = Convert.ToInt32(Session[Constants.SessionVariables.NameParamMonth]);
            int year = Convert.ToInt32(Session[Constants.SessionVariables.NameParamYear]);
            int idArm = Convert.ToInt32(Session[Constants.SessionVariables.NameParamArm]);


            int debetInt = Convert.ToInt32(e.NewValues["Debet"]);
            int kreditInt = Convert.ToInt32(e.NewValues["Kredit"]);

            string debet = debetInt.ToString("000000");
            string kredit = kreditInt.ToString("000000");

            decimal cost = Convert.ToDecimal(e.NewValues["Cost"]);

            var postingActions = new PostingActions();
            string result = postingActions.FondMoveHandPostings(year, month, idArm, null, idFondMove, debet, kredit, cost, null);
            gridHandPosting.JSProperties["cpEditHandPosting"] = result;

            e.Cancel = true;
            gridHandPosting.CancelEdit();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            int idFondMoveDetails = Convert.ToInt32(Session["IdFondMoveDetailNma"]);

            var fondMoveActions = new FondMoveActions();
            var fondMove = fondMoveActions.GetFondMove(idFondMoveDetails);

            
        
            if (fondMove.IdOperation == 7)
            {
                tabCtrlFondMoveDetail.TabPages[3].Visible = true;

                int month = Convert.ToInt32(Session[Constants.SessionVariables.NameParamMonth]);
                int year = Convert.ToInt32(Session[Constants.SessionVariables.NameParamYear]);

                cmbWriteOffStructure.DataSource = fondMoveActions.GetFondMoveReplaceStructure(month, year, idFondMoveDetails);
                cmbWriteOffStructure.DataBind();
  
                if (cmbWriteOffStructure.Items.Count != 0 && !Request[NameEventParam].Contains(NameButtonSaveFondReplace))
                {
                    int idFondMoveDetailFrom = fondMoveActions.GetIdFondMoveDetailsWriteOffReplaceStructure(fondMove.IdFondMove);
                    if (idFondMoveDetailFrom != 0)
                        if (cmbWriteOffStructure.Items.FindByValue(idFondMoveDetailFrom) !=null)
                            cmbWriteOffStructure.Items.FindByValue(idFondMoveDetailFrom).Selected = true;
                    
                }

            }
            else
                tabCtrlFondMoveDetail.TabPages[3].Visible = false;
        }
Beispiel #3
0
        protected void gridFondMove_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            int idFondMoveDetails = Convert.ToInt32(e.Keys["IdFondMoveDetail"]);
            decimal balanceCostOperation = Convert.ToDecimal(e.NewValues["BalanceCost"]);
            decimal iznosOperation = Convert.ToDecimal(e.NewValues["Iznos"]);

            var fondMoveDetailsActions = new FondMoveActions();
            string result = fondMoveDetailsActions.FondMoveDetailsModify(idFondMoveDetails, balanceCostOperation, iznosOperation);
            gridFondMove.JSProperties["cpEditCostMessage"] = result;
            e.Cancel = true;
            gridFondMove.CancelEdit();
        }
        protected void btnSaveFondReplace_Click(object sender, EventArgs e)
        {
            if (cmbWriteOffStructure.Value == null)
                ScriptManager.RegisterStartupScript(this, GetType(), "btnSaveFondReplace", "alert('Выберите значение из списка.')", true);
            else
            {
                int idFondMoveDetailsFrom = Convert.ToInt32(cmbWriteOffStructure.Value);
                int idFondMoveDetailsTo = Convert.ToInt32(Session["IdFondMoveDetailNma"]);
                int idArm = Convert.ToInt32(Session[Constants.SessionVariables.NameParamArm]);

                if (idFondMoveDetailsFrom == 0 || idFondMoveDetailsTo == 0)
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "btnSaveFondReplace", "alert('Не удалось получить операции.')", true);
                    return;
                }

                var fondMoveActions = new FondMoveActions();
                string result = fondMoveActions.ReplaceStructure(idFondMoveDetailsFrom,idFondMoveDetailsTo, idArm);
                
                ScriptManager.RegisterStartupScript(this, GetType(), "btnSaveFondReplace", "alert('" + result + "');GridFondMove.Refresh()", true);    
            }
                
        }