예제 #1
0
        public void MetaData_AfterLink()
        {
            Meta      = MetaData.GetMetaData(this);
            QHC       = new CQueryHelper();
            QHS       = Meta.Conn.GetQueryHelper();
            esercizio = (int)Meta.GetSys("esercizio");
            string filterEsercizio = QHS.CmpEq("ayear", esercizio);
            string filterPay       = QHS.CmpEq("ypay", esercizio);
            string filterPro       = QHS.CmpGe("ypro", esercizio);
            string filtroSpesa     = QHS.AppAnd(QHS.CmpEq("nphase", Meta.GetSys("maxexpensephase")), QHS.IsNotNull("idpay"));

            filtroSpesa = GetData.MergeFilters(filterEsercizio, filtroSpesa);
            GetData.SetStaticFilter(DS.expenseview, filtroSpesa);
            GetData.SetStaticFilter(DS.payment, filterPay);
            GetData.SetStaticFilter(DS.proceeds, filterPro);
            GetData.SetStaticFilter(DS.sortingview, filterEsercizio);

            object nomeFaseS = Meta.Conn.DO_READ_VALUE("expensephase", QHS.CmpEq("nphase", Meta.GetSys("maxexpensephase")), "description");
            string faseS     = (nomeFaseS != null) ? nomeFaseS.ToString() : "";

            grpSpesa.Text = faseS;
            btnSpesa.Text = faseS;

            standardTagBtnMandato = HelpForm.GetStandardTag(btnMandato.Tag);
            standardTagBtnSpesa   = HelpForm.GetStandardTag(btnSpesa.Tag);

            string filtroEntrata = QHS.AppAnd(QHS.CmpEq("nphase", Meta.GetSys("maxincomephase")), QHS.IsNotNull("idpro"));

            filtroEntrata = GetData.MergeFilters(filterEsercizio, filtroEntrata);
            GetData.SetStaticFilter(DS.incomeview, filtroEntrata);

            object nomeFaseE = Meta.Conn.DO_READ_VALUE("incomephase", QHS.CmpEq("nphase", Meta.GetSys("maxincomephase")), "description");
            string faseE     = (nomeFaseE != null) ? nomeFaseE.ToString() : "";

            grpEntrata.Text = faseE;
            btnEntrata.Text = faseE;

            standardTagBtnReversale  = HelpForm.GetStandardTag(btnReversale.Tag);
            standardTagBtnEntrata    = HelpForm.GetStandardTag(btnEntrata.Tag);
            btnCollegaBankImport.Tag = btnCollegaBankImport.Tag + "." + QHS.DoPar(QHS.CmpEq("ayear", Meta.GetSys("esercizio")));
        }
예제 #2
0
        private void ParseDate(TextBox T)
        {
            if (!T.Enabled)
            {
                return;
            }
            if (T.ReadOnly)
            {
                return;
            }
            if (T.Text == "")
            {
                m_DataRatifica = DBNull.Value;
                return;
            }
            string tag = HelpForm.GetStandardTag(T.Tag);

            tag = tag + ".d";
            string hhsep  = CultureInfo.CurrentCulture.DateTimeFormat.TimeSeparator;
            string ppsep  = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
            string S      = T.Text + hhsep + "0" + ppsep + "0";
            int    len    = S.Length;
            object valore = DBNull.Value;

            while (len > 0)
            {
                try {
                    valore = HelpForm.GetObjectFromString(typeof(DateTime), S, tag);
                    if ((valore != null) && (valore != DBNull.Value))
                    {
                        break;
                    }
                }
                catch {
                }
                len = len - 1;
                S   = S.Substring(0, len);
            }
            T.Text         = HelpForm.StringValue(valore, tag);
            m_DataRatifica = valore;
        }
예제 #3
0
        public void MetaData_AfterLink()
        {
            Meta = MetaData.GetMetaData(this);
            QHC  = new CQueryHelper();
            QHS  = Meta.Conn.GetQueryHelper();
            string filtro = "";

            if (DS.banktransaction.ExtendedProperties[MetaData.ExtraParams] != null)
            {
                filtro = DS.banktransaction.ExtendedProperties[MetaData.ExtraParams].ToString();
            }
            DataRow Parent        = Meta.SourceRow;
            string  filterpayment = QHS.MCmp(Parent, "kpay");

            GetData.SetStaticFilter(DS.payment_bankview, filterpayment);

            string filtroSpesa = QHS.AppAnd(filtro, QHS.CmpEq("nphase", Meta.GetSys("maxexpensephase")));

            string filtrostatico = filtroSpesa;

            if (Meta.SourceRow != null)
            {
                DataRow Curr = Meta.SourceRow;
                if (Curr["idexp"] != DBNull.Value)
                {
                    filtrostatico = QHS.DoPar(QHS.AppOr(QHS.DoPar(filtroSpesa), QHS.CmpEq("idexp", Curr["idexp"])));
                }
            }


            GetData.SetStaticFilter(DS.expenseview, filtrostatico);

            object nomeFase = Meta.Conn.DO_READ_VALUE("expensephase", QHS.CmpEq("nphase", Meta.GetSys("maxexpensephase")), "description");
            string fase     = (nomeFase != null) ? nomeFase.ToString() : "";

            grpMovSpesa.Text         = fase;
            btnMovSpesa.Text         = fase;
            standardTagBtnMovSpesa   = HelpForm.GetStandardTag(btnMovSpesa.Tag);
            btnCollegaBankImport.Tag = btnCollegaBankImport.Tag + "." + QHS.DoPar(QHS.CmpEq("ayear", Meta.GetSys("esercizio")));
        }
예제 #4
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 " + importototale.ToString("c") + ". Proseguo comunque?";

            try {
                decimal importo = CfgFn.GetNoNullDecimal(HelpForm.GetObjectFromString(typeof(Decimal),
                                                                                      txtImporto.Text, HelpForm.GetStandardTag(txtImporto.Tag)));
                if (((importo >= 0) && (importo <= importototale) && rdbNormale.Checked) || rdbVariazione.Checked)
                {
                    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);
        }
예제 #5
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 = importoclassificazione.ToString("c");
            }
            else
            {
                importoclassificazione = CfgFn.GetNoNullDecimal(HelpForm.GetObjectFromString(typeof(Decimal),
                                                                                             txtImporto.Text, HelpForm.GetStandardTag(txtImporto.Tag)));
                decimal percentuale = 100;
                if (importototale != 0)
                {
                    percentuale = importoclassificazione / 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");
            }
        }