Ejemplo n.º 1
0
        public override bool DO_POST()
        {
            bool res = base.DO_POST();

            if (res)
            {
                if (dsSource != null)
                {
                    if (dsSource.Tables["expense"].Rows.Count > 0)
                    {
                        DataRow SourceExpense = dsSource.Tables["expense"].Rows[0];
                        int     fasespesafine = Convert.ToInt32(DS.Tables["expense"].ExtendedProperties["fasespesafine"]);
                        DataRow Last          = DS.Tables["expense"].Select("nphase=" + fasespesafine)[0];
                        int     idlastphase   = CfgFn.GetNoNullInt32(Last["idexp"]);
                        SourceExpense["idexp"]  = idlastphase;
                        SourceExpense["nphase"] = fasespesafine;

                        if (dsSource.Tables["expenselast"].Rows.Count > 0)
                        {
                            DataRow SourceExpenseLast = dsSource.Tables["expenselast"].Rows[0];
                            SourceExpenseLast["idexp"] = idlastphase;
                        }


                        if (dsSource.Tables["expenseyear"].Rows.Count > 0)
                        {
                            DataRow SourceExpenseYear = dsSource.Tables["expenseyear"].Rows[0];
                            SourceExpenseYear["idexp"] = idlastphase;
                        }
                    }

                    if (DS.Tables.Contains("payment"))
                    {
                        foreach (DataRow rPayment in DS.Tables["payment"].Rows)
                        {
                            int kpay = CfgFn.GetNoNullInt32(rPayment["kpay"]);
                            if (kpay == 0)
                            {
                                continue;
                            }
                            Conn.CallSP("compute_payment_bank", new object[] { kpay });
                        }
                    }

                    if (DS.Tables.Contains("proceeds"))
                    {
                        foreach (DataRow rProceeds in DS.Tables["proceeds"].Rows)
                        {
                            int kpro = CfgFn.GetNoNullInt32(rProceeds["kpro"]);
                            if (kpro == 0)
                            {
                                continue;
                            }
                            Conn.CallSP("compute_proceeds_bank", new object[] { kpro });
                        }
                    }
                }
            }
            return(res);
        }
Ejemplo n.º 2
0
        bool CustomChangeTab(int oldTab, int newTab)
        {
            if (oldTab == 0)
            {
                try {
                    DataSet Out = Conn.CallSP("closeyear_assetgrant",
                                              new Object[4] {
                        Meta.GetSys("esercizio"),
                        DBNull.Value,             // idasset
                        DBNull.Value,             // idpiece
                        "V"
                    }
                                              );

                    if (Out == null || Out.Tables.Count == 0)
                    {
                        MessageBox.Show(this, "Procedura terminata con errore", "Errore");
                        return(false);
                    }
                    Out.Tables[0].TableName = "Cespiti ammortizzati";
                    HelpForm.SetDataGrid(gridRisultati, Out.Tables[0]);
                    if (Out.Tables[0].Rows.Count == 0)
                    {
                        btnCreaRisconti.Visible = false;
                        lblRiepilogo.Text       = "Non Saranno Generati Risconti per i Cespiti ammortizzati nell'esercizio corrente";
                    }
                    else
                    {
                        btnCreaRisconti.Visible = true;
                        lblRiepilogo.Text       = "Saranno Generati i seguenti Risconti per i Cespiti ammortizzati nell'esercizio corrente";
                    }
                }
                catch (Exception E) {
                    MessageBox.Show(E.Message);
                    return(false);
                }


                return(CheckStandard()); // 0->1: nothing to do
            }
            if ((oldTab == 1) && (newTab == 0))
            {
                return(true);                                //1->0:nothing to do!
            }
            return(true);
        }
Ejemplo n.º 3
0
        public override bool DO_POST()
        {
            bool res = base.DO_POST();

            ga.updateSource(dsSource, res);
            if (res)
            {
                if (ga.DSP.Tables.Contains("payment"))
                {
                    foreach (DataRow rPayment in ga.DSP.Tables["payment"].Rows)
                    {
                        int kpay = CfgFn.GetNoNullInt32(rPayment["kpay"]);
                        if (kpay == 0)
                        {
                            continue;
                        }
                        Conn.CallSP("compute_payment_bank", new object[] { kpay });
                    }
                }

                if (ga.DSP.Tables.Contains("proceeds"))
                {
                    foreach (DataRow rProceeds in ga.DSP.Tables["proceeds"].Rows)
                    {
                        int kpro = CfgFn.GetNoNullInt32(rProceeds["kpro"]);
                        if (kpro == 0)
                        {
                            continue;
                        }
                        Conn.CallSP("compute_proceeds_bank", new object[] { kpro });
                    }
                }
                dsSource.AcceptChanges();
            }
            return(res);
        }