Esempio n. 1
0
        public void MetaData_AfterFill()
        {
            DataRow lastRow = HelpForm.GetLastSelected(DS.finlevel);
            int     flag    = CfgFn.GetNoNullInt32(lastRow["flag"]);

            txtLungCodice.Text = (flag >> 8).ToString();
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        private void gestisciGruppoPrevisioneSecondaria()
        {
            int finkind = CfgFn.GetNoNullInt32(Meta.GetSys("fin_kind"));

            grpPrevSec.Visible     = (finkind == 3);
            grpPrevSecCons.Visible = (finkind == 3);
        }
Esempio n. 4
0
        /// <summary>
        /// True if "selectable" and with "no chidren"
        /// </summary>
        /// <returns></returns>
        override public bool CanSelect()
        {
            if (!row_exists())
            {
                return(false);
            }
            //if (selectable_level_field == null) return true;
            DataRow Lev = LevelRow();

            if (Lev == null)
            {
                return(false);
            }
            //if (Lev[selectable_level_field].ToString().ToLower() == "n") return false;
            byte flag = CfgFn.GetNoNullByte(Lev["flag"]);

            if ((flag & 2) == 0)
            {
                return(false);
            }
            if (HasAutoChildren())
            {
                return(false);
            }
            return(true);
        }
Esempio n. 5
0
        public override void SetDefaults(DataTable PrimaryTable)
        {
            base.SetDefaults(PrimaryTable);
            //SetDefault(PrimaryTable,"delete_flagcompeconomica","N");

            if (PrimaryTable.ExtendedProperties["app_default"] != null)
            {
                Hashtable H = (Hashtable)PrimaryTable.ExtendedProperties["app_default"];
                foreach (string field in new string[] { "idexp", "idreg",
                                                        "description", "doc", "docdate",
                                                        "idman",
                                                        "nphase", "autocode", "autokind", "idpayment", "idchargehandling" })
                {
                    if (H[field] != null)
                    {
                        SetDefault(PrimaryTable, field, H[field]);
                    }
                }
                SetDefault(PrimaryTable, "ymov", GetSys("esercizio").ToString());
                //SetDefault(PrimaryTable, "ycreation", GetSys("esercizio").ToString());
                SetDefault(PrimaryTable, "adate", GetSys("datacontabile"));
                return;
            }
            SetDefault(PrimaryTable, "ymov", GetSys("esercizio").ToString());
            //SetDefault(PrimaryTable, "ycreation", GetSys("esercizio").ToString());
            if (CfgFn.GetNoNullInt32(PrimaryTable.Columns["nphase"].DefaultValue) == 0)
            {
                SetDefault(PrimaryTable, "nphase", 1);
            }
            SetDefault(PrimaryTable, "adate", GetSys("datacontabile"));
        }
Esempio n. 6
0
        private void VisualizzaCheckBox()
        {
            int n_chk = 8;

            for (int i = 1; i <= (n_chk - 1); i++)
            {
                CheckBox chk = GetCtrlByName("chkCsaUsability" + n_chk.ToString()) as CheckBox;
                if (chk == null)
                {
                    return;
                }
                chk.Visible = false;
            }

            string    num = ""; int bitposition = 0;
            DataTable tservicecsausability = Meta.Conn.RUN_SELECT("servicecsausability", "*", null, null, null, null, true);

            foreach (DataRow r in tservicecsausability.Rows)
            {
                num         = r["idlabel"].ToString();
                bitposition = CfgFn.GetNoNullInt32(r["bitposition"]);
                string dicitura = r["description"].ToString();

                CheckBox CB = GetCtrlByName("chkCsaUsability" + num) as CheckBox;
                if (CB == null)
                {
                    continue;
                }
                CB.Text    = dicitura;
                CB.Tag     = "servicecsamask.value:" + bitposition.ToString();
                CB.Visible = true;
            }
        }
Esempio n. 7
0
        public void MetaData_AfterLink()
        {
            Conn = MetaData.GetConnection(this);
            QHS  = Conn.GetQueryHelper();
            DataAccess.SetTableForReading(DS.sorting01, "sorting");
            DataAccess.SetTableForReading(DS.sorting02, "sorting");
            DataAccess.SetTableForReading(DS.sorting03, "sorting");
            DataAccess.SetTableForReading(DS.sorting04, "sorting");
            DataAccess.SetTableForReading(DS.sorting05, "sorting");

            DataTable tUniConfig = Conn.RUN_SELECT("uniconfig", "*", null,
                                                   null, null, null, true);

            if ((tUniConfig != null) && (tUniConfig.Rows.Count > 0))
            {
                DataRow r          = tUniConfig.Rows[0];
                object  idsorkind1 = r["idsorkind01"];
                object  idsorkind2 = r["idsorkind02"];
                object  idsorkind3 = r["idsorkind03"];
                object  idsorkind4 = r["idsorkind04"];
                object  idsorkind5 = r["idsorkind05"];
                CfgFn.SetGBoxClass0(this, 1, idsorkind1);
                CfgFn.SetGBoxClass0(this, 2, idsorkind2);
                CfgFn.SetGBoxClass0(this, 3, idsorkind3);
                CfgFn.SetGBoxClass0(this, 4, idsorkind4);
                CfgFn.SetGBoxClass0(this, 5, idsorkind5);
                if (idsorkind1 == DBNull.Value && idsorkind2 == DBNull.Value &&
                    idsorkind3 == DBNull.Value && idsorkind4 == DBNull.Value && idsorkind5 == DBNull.Value)
                {
                    tabControl.TabPages.Remove(tabAttributi);
                }
            }
        }
Esempio n. 8
0
        public override bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }

            if (R["taxablecode"].ToString() == "")
            {
                errmess  = "Selezionare l'imponibile di riferimento";
                errfield = "taxablecode";
                return(false);
            }

            if (CfgFn.GetNoNullInt32(R["startmonth"]) <= 0)
            {
                errmess  = "Selezionare il mese iniziale";
                errfield = "startmonth";
                return(false);
            }
            if (CfgFn.GetNoNullInt32(R["stopmonth"]) <= 0)
            {
                errmess  = "Selezionare il mese finale";
                errfield = "stopmonth";
                return(false);
            }
            if (CfgFn.GetNoNullInt32(R["startmonth"]) > CfgFn.GetNoNullInt32(R["stopmonth"]))
            {
                errmess  = "Il mese finale non può essere inferiore a quello iniziale";
                errfield = "stopmonth";
                return(false);
            }
            return(true);
        }
Esempio n. 9
0
    public override void AfterLink(bool firsttime, bool formToLink)
    {
        //HelpForm.SetFormatForColumn(DS.bookingdetail.Columns["number"], "N");

        Meta.DefaultListType = "list";
        SearchTable          = "bookingdetailview";
        HelpForm.SetFormatForColumn(DS.bookingdetailview.Columns["number"], "n");

        DataAccess.SetTableForReading(DS.sorting1, "sorting");
        DataAccess.SetTableForReading(DS.sorting2, "sorting");
        DataAccess.SetTableForReading(DS.sorting3, "sorting");


        Meta.CanInsert     = false;
        Meta.CanInsertCopy = false;
        Meta.CanCancel     = false;
        QHS = Conn.GetQueryHelper();
        QHC = new CQueryHelper();
        int idman = CfgFn.GetNoNullInt32(Session["CodiceResponsabile"]);

        if (idman == 0)
        {
            return;
        }
        string filter = QHS.AppAnd(QHS.CmpEq("idman", idman), QHS.IsNull("authorized"));

        GetData.SetStaticFilter(DS.bookingdetailview, filter);
    }
Esempio n. 10
0
        private void chiusuraEsercizio()
        {
            if (DS.accountingyear.Rows.Count == 0)
            {
                return;
            }
            DataRow rAccountingYear = DS.accountingyear.Rows[0];
            int     flag            = CfgFn.GetNoNullInt32(rAccountingYear["flag"]);

            if ((flag & 16) == 0)
            {
                flag |= 0x10;
            }

            rAccountingYear["flag"] = flag;

            PostData Post = Meta.Get_PostData();

            Post.InitClass(DS, Meta.Conn);
            if (!Post.DO_POST())
            {
                MessageBox.Show(this, "Errore durante la chiusura dell'esercizio" + esercizio);
            }
            else
            {
                MessageBox.Show(this, "Esercizio " + esercizio + " chiuso correttamente");
            }
            this.Close();
        }
Esempio n. 11
0
        public object translate(object oldvalue)
        {
            if (oldvalue == DBNull.Value || oldvalue == null)
            {
                return(DBNull.Value);
            }
            if (oldvalue.ToString().Length == 4)
            {
                return(oldvalue);
            }
            if (oldvalue.ToString().Length == 8)
            {
                return(IDLev1[oldvalue.ToString()].ToString());
            }
            string Sleft    = oldvalue.ToString().Substring(0, 8);
            string SLeftNew = IDLev1[Sleft].ToString();
            string S        = oldvalue.ToString();
            string Sright   = "";

            if (S.Length > 12)
            {
                Sright = S.Substring(12);
            }

            int max   = CfgFn.GetNoNullInt32(H[SLeftNew]);
            int ncurr = getnumber(S, 2) + max + 1; //è necessario sommare 1 perché gli upb hanno base zero

            string Smain = ncurr.ToString().PadLeft(4, '0');

            return(SLeftNew + Smain + Sright);
        }
Esempio n. 12
0
        public override DataRow Get_New_Row(DataRow ParentRow, DataTable T)
        {
            DataTable tConfigurazione = T.DataSet.Tables["config"];

            DataRow[] rConfig = tConfigurazione.Select(QHC.CmpEq("ayear", GetSys("esercizio")));
            if (rConfig.Length == 0)
            {
                MessageBox.Show("Bisogna inserire i dati nel form di configurazione del contratto",
                                "Contratto - Dati Mancanti", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(null);
            }

            int    flag_autodocnumbering = CfgFn.GetNoNullInt32(rConfig[0]["flag_autodocnumbering"]);
            string kind = ((flag_autodocnumbering & 0x10) == 0) ? "A" : "M";

            RowChange.SetSelector(T, "ycon");
            RowChange.MarkAsAutoincrement(T.Columns["idcon"], null,
                                          Conn.GetSys("esercizio").ToString().Substring(2, 2), 6);
            if (kind.ToUpper() == "A")
            {
                RowChange.MarkAsAutoincrement(T.Columns["ncon"], null, null, 0);
            }
            else
            {
                int nmax = CfgFn.GetNoNullInt32(
                    Conn.DO_READ_VALUE("parasubcontract", QHS.CmpEq("ycon", GetSys("esercizio"))
                                       , "MAX(CONVERT(int,ncon))")) + 1;
                SetDefault(T, "ncon", nmax);
            }

            return(base.Get_New_Row(ParentRow, T));
        }
Esempio n. 13
0
        Dictionary <string, decimal> ripartisciPerditaInBaseARiserve(decimal perdita, DataTable riserve)
        {
            decimal sommaRiserve = CfgFn.GetNoNullDecimal(riserve.Compute("sum(amount)", QHC.CmpGt("amount", 0)));

            Dictionary <string, decimal> q = new Dictionary <string, decimal>();
            decimal sommaDaRipartire       = perdita;

            if (sommaRiserve == sommaDaRipartire)
            {
                foreach (DataRow r in riserve.Rows)
                {
                    string idacc = r["idacc"].ToString();
                    q[idacc] = CfgFn.GetNoNullDecimal(r["amount"]);
                }
                return(q);
            }

            foreach (DataRow r in riserve.Select(QHC.CmpGt("amount", 0), "amount desc"))
            {
                string  idacc   = r["idacc"].ToString();
                decimal riserva = CfgFn.GetNoNullDecimal(r["amount"]);
                decimal quota   = 0;
                if (riserva != 0)
                {
                    quota = CfgFn.RoundValuta(sommaDaRipartire * (riserva / sommaRiserve));
                }
                q[idacc]          = quota;
                sommaRiserve     -= riserva;
                sommaDaRipartire -= quota;
            }
            return(q);
        }
Esempio n. 14
0
        /**
         *  R ha le colonne: idupb, amount ove amount è il risultato economico dell'upb ribaltato dall'apertura
         *
         **/

        Dictionary <string, decimal> ripartisciUtileInBaseATabella(decimal utile, DataTable quote)
        {
            decimal sommaQuote             = MetaData.SumColumn(quote, "quota");
            Dictionary <string, decimal> q = new Dictionary <string, decimal>();
            decimal sommaDaRipartire       = utile;

            if (sommaQuote < 1)
            {
                foreach (DataRow r in quote.Rows)
                {
                    string  idupb     = r["idupb_dest"].ToString();
                    decimal quotaPerc = CfgFn.GetNoNullDecimal(r["quota"]);
                    decimal quota     = sommaDaRipartire * quotaPerc;
                    q[idupb] = quota;
                }
            }

            foreach (DataRow r in quote.Rows)
            {
                string  idupb     = r["idupb_dest"].ToString();
                decimal quotaPerc = CfgFn.GetNoNullDecimal(r["quota"]);
                decimal quota     = sommaDaRipartire * (quotaPerc / sommaQuote);
                q[idupb]          = quota;
                sommaQuote       -= quotaPerc;
                sommaDaRipartire -= quota;
            }
            return(q);
        }
Esempio n. 15
0
        public override DataRow Get_New_Row(DataRow ParentRow, DataTable T)
        {
            string    testoMessaggio  = "Bisogna inserire i dati nel form di configurazione del contratto professionale";
            string    filteresercizio = QHC.CmpEq("ayear", GetSys("esercizio"));
            DataTable tConfigurazione = T.DataSet.Tables["config"];

            DataRow[] rConfig = tConfigurazione.Select(filteresercizio);
            if (rConfig.Length == 0)
            {
                MessageBox.Show(testoMessaggio, "Contratto Professionale - Dati Mancanti", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(null);
            }

            int    flag_autodocnumbering = CfgFn.GetNoNullInt32(rConfig[0]["flag_autodocnumbering"]);
            string kind = ((flag_autodocnumbering & 0x40) == 0) ? "A" : "M";

            if (kind.ToUpper() == "A")
            {
                string reset = rConfig[0]["profservice_flagrestart"].ToString();
                if (reset.ToUpper() == "S")
                {
                    RowChange.SetSelector(T, "ycon");
                }
                RowChange.MarkAsAutoincrement(T.Columns["ncon"], null, null, 0);
            }
            else
            {
                string filter = QHS.CmpEq("ycon", GetSys("esercizio"));
                int    nmax   = CfgFn.GetNoNullInt32(
                    Conn.DO_READ_VALUE("profservice", filter, "MAX(ncon)")) + 1;
                SetDefault(T, "ncon", nmax);
            }
            return(base.Get_New_Row(ParentRow, T));
        }
Esempio n. 16
0
 public override bool IsValid(DataRow R, out string errmess, out string errfield)
 {
     if (CfgFn.GetNoNullInt32(R["nmonth"]) == 0)
     {
         errmess  = "Valorizzare il mese";
         errfield = "nmonth";
         return(false);
     }
     if (!base.IsValid(R, out errmess, out errfield))
     {
         return(false);
     }
     if (R["paymentdate"] is DateTime)
     {
         DateTime paymentDate   = (DateTime)R["paymentdate"];
         DateTime dataContabile = (DateTime)GetSys("datacontabile");
         if (paymentDate < dataContabile.Date)
         {
             errmess  = "La data di versamento non può essere inferiore alla data contabile";
             errfield = "paymentdate";
             return(false);
         }
     }
     return(true);
 }
Esempio n. 17
0
        public void MetaData_AfterLink()
        {
            Meta            = MetaData.GetMetaData(this);
            QHC             = new CQueryHelper();
            QHS             = Meta.Conn.GetQueryHelper();
            filteresercizio = QHS.CmpEq("ayear", Meta.GetSys("esercizio"));
            DataAccess Conn = Meta.Conn;

            DataRow rbudgetvardetail = Meta.SourceRow;
            DataRow rbudgetvar       = rbudgetvardetail.GetParentRow("budgetvarbudgetvardetail");
            object  idsorkind        = rbudgetvar["idsorkind"];
            string  c_filter         = QHC.CmpEq("idsorkind", idsorkind);
            string  s_filter         = QHS.CmpEq("idsorkind", idsorkind);

            GetData.SetStaticFilter(DS.sorting, c_filter);
            object sortingKind = Conn.DO_READ_VALUE("sortingkind", s_filter, "description");

            if (sortingKind != null)
            {
                this.Name      = "Dettaglio Variazioni Budget per \"" + sortingKind.ToString() + "\"";
                gboxclass.Text = sortingKind.ToString();
            }

            if (rbudgetvar.RowState == DataRowState.Modified)
            {
                int CurrentStatus  = CfgFn.GetNoNullInt32(rbudgetvar["idbudgetvarstatus"]);
                int OriginalStatus = CfgFn.GetNoNullInt32(rbudgetvar["idbudgetvarstatus", DataRowVersion.Original]);
                if ((OriginalStatus == 5) || ((CurrentStatus == 5) && (rbudgetvar.RowState == DataRowState.Modified)))
                {
                    txtDescrizione.Focus();
                }
            }
        }
Esempio n. 18
0
        /// <summary>
        /// True if "selectable" and with "no chidren" or maxlevel==current level
        /// </summary>
        /// <returns></returns>
        override public bool CanSelect()
        {
            if (!row_exists())
            {
                return(false);
            }
            DataRow Lev = LevelRow();

            if (Lev == null)
            {
                return(false);
            }
            if (maxlevel > 0)
            {
                if (Lev["nlevel"].ToString() == maxlevel.ToString())
                {
                    return(true);
                }
            }
            //int thislev = CfgFn.GetNoNullInt32(Lev["nlevel"]);
            //if (thislev < levelop) return false;
            int flag = CfgFn.GetNoNullInt32(Lev["flag"]);

            if ((flag & 2) == 0)
            {
                return(false);
            }
            if (HasAutoChildren())
            {
                return(false);
            }
            return(true);
        }
Esempio n. 19
0
        private void impostaCampi(DataRow R, string listingtype)
        {
            if (listingtype != "documentitrasmessi")
            {
                return;
            }
            if (R["autokind"] == DBNull.Value)
            {
                return;
            }
            bool flagunchanged = false;

            if (R.RowState == DataRowState.Unchanged)
            {
                flagunchanged = true;
            }
            if (CfgFn.GetNoNullInt32(R["autokind"]) == 10)
            {
                R["!varkind"] = "Annullamento Parziale";
            }
            if (CfgFn.GetNoNullInt32(R["autokind"]) == 11)
            {
                R["!varkind"] = "Annullamento";
            }
            ;
            if (CfgFn.GetNoNullInt32(R["autokind"]) == 22)
            {
                R["!varkind"] = "Modifica Dati";
            }
            if (flagunchanged)
            {
                R.AcceptChanges();
            }
        }
Esempio n. 20
0
        void CalcolaTotale(bool read)
        {
            if (Meta == null)
            {
                return;
            }
            if (Meta.IsEmpty)
            {
                return;
            }
            if (DS.epaccvar.Rows.Count == 0)
            {
                return;
            }
            if (read)
            {
                Meta.GetFormData(true);
            }
            DataRow R      = DS.epaccvar.Rows[0];
            decimal totale = CfgFn.GetNoNullDecimal(R["amount"]);

            for (int i = 2; i <= 5; i++)
            {
                totale += CfgFn.GetNoNullDecimal(R["amount" + i.ToString()]);
            }
            txtTotale.Text = totale.ToString("c");
        }
Esempio n. 21
0
        public override bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }
            DataRow rPosition      = R.GetParentRow("position_foreigngroupruledetail");
            int     minincomeclass = CfgFn.GetNoNullInt32(R["minincomeclass"]);
            int     maxincomeclass = CfgFn.GetNoNullInt32(R["maxincomeclass"]);
            int     max            = CfgFn.GetNoNullInt32(rPosition["maxincomeclass"]);

            if (minincomeclass < 0)
            {
                errmess  = "La classe minima deve essere maggiore o uguale a zero";
                errfield = "minincomeclass";
                return(false);
            }
            if (minincomeclass > maxincomeclass)
            {
                errmess  = "La classe minima deve essere <= della classe massima";
                errfield = "minincomeclass";
                return(false);
            }
            if (maxincomeclass > max)
            {
                errmess  = "Per la qualifica '" + rPosition["description"] + "' la massima classe stipendiale è " + max;
                errfield = "maxincomeclass";
                return(false);
            }
            return(true);
        }
Esempio n. 22
0
        private DataRow fillEntry(DataTable tEntry)
        {
            int    esercizio = (int)Meta.GetSys("esercizio");
            string filter    = QHS.CmpEq("yentry", esercizio);

            object nEntry = Meta.Conn.DO_READ_VALUE("entry", filter, "MAX(nentry)");

            if (nEntry == null)
            {
                MessageBox.Show(this, "Errore nel calcolo dell'ultima scrittura", "Errore");
                return(null);
            }
            int freeN = 1 + CfgFn.GetNoNullInt32(nEntry);

            DataRow  rEntry = tEntry.NewRow();
            DateTime dec31  = new DateTime(esercizio, 12, 31);

            rEntry["yentry"]      = esercizio;
            rEntry["nentry"]      = freeN;
            rEntry["identrykind"] = "7";
            rEntry["adate"]       = dec31;
            rEntry["description"] = "Scrittura di apertura esercizio " + esercizio;
            rEntry["ct"]          = DateTime.Now;
            rEntry["cu"]          = "APERTURA";
            rEntry["lt"]          = DateTime.Now;
            rEntry["lu"]          = "'APERTURA'";

            tEntry.Rows.Add(rEntry);

            return(rEntry);
        }
Esempio n. 23
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     insertedIBAN = CfgFn.normalizzaIBAN(txtIBAN.Text.ToUpper());
     if (insertedIBAN == "")
     {
         return;
     }
     if (insertedIBAN.Length < 2)
     {
         MessageBox.Show("Lunghezza del codice IBAN errata");
         this.DialogResult = DialogResult.None;
     }
     if (!insertedIBAN.StartsWith("IT"))
     {
         return;
     }
     if (!CfgFn.verificaIban(insertedIBAN))
     {
         MessageBox.Show("Il codice digitato non è un codice IBAN valido!");
         this.DialogResult = DialogResult.None;
     }
     if (insertedIBAN.Length != 27)
     {
         MessageBox.Show("Il codice IBAN per l'Italia deve essere composto da 27 caratteri");
         this.DialogResult = DialogResult.None;
     }
 }
Esempio n. 24
0
        private bool fillEntryDetail(DataTable tEntryDetail, DataRow rEntry, DataRow rSaldo)
        {
            object  newidAcc      = attualizzaAccount(rSaldo["idacc"].ToString());
            decimal reverseAmount = -CfgFn.GetNoNullDecimal(rSaldo["amount"]);

            if (newidAcc == null)
            {
                MessageBox.Show(this, "Errore nell'attualizzazione del conto", "Errore");
                return(false);
            }

            DataRow rEntryDetail = tEntryDetail.NewRow();
            object  nDetMax      = tEntryDetail.Compute("MAX(ndetail)", null);
            int     freeDetail   = 1 + CfgFn.GetNoNullInt32(nDetMax);

            rEntryDetail["yentry"]  = rEntry["yentry"];
            rEntryDetail["nentry"]  = rEntry["nentry"];
            rEntryDetail["ndetail"] = freeDetail;
            rEntryDetail["amount"]  = reverseAmount;
            rEntryDetail["idacc"]   = newidAcc;
            rEntryDetail["idreg"]   = rSaldo["idreg"];
            rEntryDetail["idupb"]   = rSaldo["idupb"];
            rEntryDetail["ct"]      = DateTime.Now;
            rEntryDetail["cu"]      = "APERTURA";
            rEntryDetail["lt"]      = DateTime.Now;
            rEntryDetail["lu"]      = "'APERTURA'";

            tEntryDetail.Rows.Add(rEntryDetail);
            return(true);
        }
Esempio n. 25
0
        public override string InitClass(DataSet DS, DataAccess Conn)
        {
            int fasefine     = CfgFn.GetNoNullInt32(DS.Tables["expense"].Rows[0]["nphase"]);
            int fasespesamax = CfgFn.GetNoNullInt32(Conn.GetSys("maxexpensephase"));

            ga = new GestioneAutomatismi(null, Conn, Disp, DS, fasefine, fasespesamax, "expense", false);
            bool res = ga.GeneraAutomatismiAfterPost(true);

            if (!res)
            {
                return("NoSave");
            }
            DataSet DSP = ga.DSP;

            MetaData metaSpesa = Disp.Get("expense");

            metaSpesa.ComputeRowsAs(DSP.Tables["expense"], "posting");

            MetaData metaEntrata = Disp.Get("income");

            metaEntrata.ComputeRowsAs(DSP.Tables["income"], "posting");

            MetaData metaVarSpesa = Disp.Get("expensevar");

            metaVarSpesa.ComputeRowsAs(DSP.Tables["expensevar"], "posting");

            return(base.InitClass(DSP, Conn));
        }
Esempio n. 26
0
        private void txtImporto_Leave(object sender, System.EventArgs e)
        {
            if (inChiusura)
            {
                return;
            }
            if (!txtImporto.Modified)
            {
                return;
            }
            if (!checkimporto())
            {
                // ripristina l'importo originale
                txtImporto.Text = importomovimento.ToString("c");
            }
            else
            {
                importomovimento = CfgFn.GetNoNullDecimal(HelpForm.GetObjectFromString(typeof(Decimal),
                                                                                       txtImporto.Text, HelpForm.GetStandardTag(txtImporto.Tag)));
                decimal percentuale = 100;
                if (importototale != 0)
                {
                    percentuale = importomovimento / importototale * 100;
                }

                decimal rounded = Math.Round(percentuale, 4);
                // calcola la percentuale in base all'importo
                txtPercentuale.Text = HelpForm.StringValue(rounded, "x.y.fixed.4...1");
            }
        }
Esempio n. 27
0
        public void MetaData_AfterActivation()
        {
            gestisciGruppoPrevisioneSecondaria();
            calcolaConsolidato();

            string    filteresercizio = QHS.CmpEq("ayear", Meta.GetSys("esercizio"));
            DataTable tConfig         = DataAccess.RUN_SELECT(Meta.Conn, "config", null, null, filteresercizio, null, null, true);

            if (tConfig != null)
            {
                if (tConfig.Rows.Count != 0)
                {
                    DataRow rConfig = tConfig.Rows[0];

                    //Imposta groupbox previsioni competenza
                    string nomeprevsecondaria = CfgFn.NomePrevisioneSecondaria(Meta.Conn);
                    if (nomeprevsecondaria != null)
                    {
                        grpPrevSec.Text = nomeprevsecondaria;
                    }
                    gboxPrimaPrevisione.Text = CfgFn.NomePrevisionePrincipale(Meta.Conn);

                    ImpostaLabelRipartizione(rConfig);
                }
            }
        }
Esempio n. 28
0
        private bool checkimporto()
        {
            bool OK = false;

            if (txtImporto.Text == "")
            {
                return(false);
            }
            string errmsg = "L'importo dovrebbe essere un numero compreso \r" +
                            "tra 0 e " + (importoresiduo + importooriginale).ToString("c") + ". Proseguo comunque?";

            try {
                decimal importo = CfgFn.GetNoNullDecimal(HelpForm.GetObjectFromString(typeof(Decimal),
                                                                                      txtImporto.Text, HelpForm.GetStandardTag(txtImporto.Tag)));
                if ((importo >= 0) && (importo <= (importoresiduo + importooriginale)))
                {
                    OK = true;
                }
                else
                {
                    OK = (MessageBox.Show(errmsg, "Avviso", MessageBoxButtons.YesNo) == DialogResult.Yes);
                }
            }
            catch {
                MessageBox.Show("E' necessario inserire un numero", "Avviso",
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Exclamation);
                return(false);
            }
            return(OK);
        }
Esempio n. 29
0
        private void CalcolaImportiEUR()
        {
            DataRow Curr      = DS.estimatedetail.Rows[0];
            DataRow rEstimate = Curr.GetParentRow("estimate_estimatedetail");
            DataRow rIvaKind  = Curr.GetParentRow("ivakindestimatedetail");

            if (rIvaKind == null || rEstimate == null)
            {
                txtImponibileEUR.Text = "";
                txtIvaEUR.Text        = "";
                return;
            }

            try {
                double tassocambio      = CfgFn.GetNoNullDouble(rEstimate["exchangerate"]);
                double aliquota         = CfgFn.GetNoNullDouble(rIvaKind["rate"]);
                double imponibile       = CfgFn.GetNoNullDouble(Curr["taxable"]);
                double quantita         = CfgFn.GetNoNullDouble(Curr["number"]);
                double sconto           = CfgFn.GetNoNullDouble(Curr["discount"]);
                double imponibiletot    = CfgFn.RoundValuta((imponibile * quantita * (1 - sconto)));
                double imponibiletotEUR = CfgFn.RoundValuta(imponibiletot * tassocambio);
                double iva    = CfgFn.GetNoNullDouble(Curr["tax"]);
                double ivaEUR = CfgFn.RoundValuta(iva * tassocambio);

                txtImponibileEUR.Text = HelpForm.StringValue(imponibiletotEUR,
                                                             "x.y.fixed.2...1");
                //imponibiletotEUR.ToString("n");
                txtIvaEUR.Text = HelpForm.StringValue(ivaEUR,
                                                      "x.y.fixed.2...1"); //                .ToString("n");
            }
            catch {
                txtImponibileEUR.Text = "";
                txtIvaEUR.Text        = "";
            }
        }
Esempio n. 30
0
        private void CalcolaImportiEUR()
        {
            try {
                double imponibile = CfgFn.GetNoNullDouble(
                    HelpForm.GetObjectFromString(typeof(double), txtNewImportoUnitario.Text, "x.y"));

                double quantita = CfgFn.GetNoNullDouble(
                    HelpForm.GetObjectFromString(typeof(double), txtNewQuantita.Text, "x.y"));

                double aliquota = CfgFn.GetNoNullDouble(
                    HelpForm.GetObjectFromString(typeof(double), txtNewAliquota.Text, "x.y.fixed.4..%.100"));

                double sconto = CfgFn.GetNoNullDouble(
                    HelpForm.GetObjectFromString(typeof(double), txtNewSconto.Text, "x.y.fixed.4..%.100"));

                double imponibiletot = CfgFn.RoundValuta((imponibile * quantita * (1 - sconto)));

                double imponibiletotEUR = CfgFn.RoundValuta(imponibiletot * tassoCambio);

                //double iva = CfgFn.RoundValuta(imponibiletot * aliquota);
                double iva = CfgFn.GetNoNullDouble(
                    HelpForm.GetObjectFromString(typeof(double), txtNewIvaValuta.Text, "x.y"));

                double ivaEUR = CfgFn.RoundValuta(iva * tassoCambio);

                txtNewImponibileEuro.Text = HelpForm.StringValue(imponibiletotEUR,
                                                                 "x.y.fixed.2...1");
                txtNewIvaEuro.Text = HelpForm.StringValue(ivaEUR, "x.y.fixed.2...1");
            }
            catch {
                txtNewImponibileEuro.Text = "";
                txtNewIvaEuro.Text        = "";
            }
        }