예제 #1
0
        decimal totSpese(string deduction)
        {
            deduction = deduction.ToUpper();
            decimal totSpeseFiscali = 0;
            var     filter          = QHC.NullOrLe("ayear", esercizio);

            if (SpeseOccasionale == null)
            {
                return(0);
            }
            // Calcola le spese deducibili previdenzialemente di QUESTO Contratto
            if (SpeseOccasionale.Select(filter).Length == 0)
            {
                return(totSpeseFiscali);
            }
            foreach (var r in SpeseOccasionale.Select(filter))
            {
                var filterk = QHC.CmpEq("idlinkedrefund", r["idlinkedrefund"]);
                var rts     = TipoSpesa.Select(filterk);
                if (rts.Length == 0)
                {
                    continue;
                }
                var isFiscale = rts[0]["deduction"] == DBNull.Value || rts[0]["deduction"].ToString().ToUpper() == deduction;
                if (isFiscale)
                {
                    totSpeseFiscali += CfgFn.GetNoNullDecimal(r["amount"]);
                }
            }
            return(totSpeseFiscali);
        }
예제 #2
0
        public void MetaData_AfterActivation()
        {
            DataRow CfgRow = DS.config.Rows[0];

            startivabalance   = CfgFn.GetNoNullDecimal(CfgRow["mainstartivabalance"]);
            startivabalance12 = CfgFn.GetNoNullDecimal(CfgRow["mainstartivabalance12"]);

            if (MovimentiFinanziariConfigurati())
            {
                gboxmanuale.Visible = false;
            }
            else
            {
                gboxmovimenti.Visible = false;
            }

            if (MovimentiFinanziariConfigurati12())
            {
                gboxmanuale12.Visible = false;
            }
            else
            {
                gboxmovimenti12.Visible = false;
            }
        }
예제 #3
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);
        }
예제 #4
0
        void esportaPagamento(DataRow R, string tag)
        {
            string filtrodipartimento;
            string filtropagamento;

            filtropagamento    = QHC.MCmp(R, new string[] { "yservreg", "nservreg" });
            filtrodipartimento = QHC.CmpEq("iddbdepartment", R["iddbdepartment"]);
            filtropagamento    = GetData.MergeFilters(filtropagamento, filtrodipartimento);
            if (R["employkind"].ToString().ToUpper() == "C")
            {
                foreach (DataRow Pag in tServicePayment.Select(filtropagamento, "semesterpay"))
                {
                    writer.WriteStartElement(tag);
                    scriviXml(Pag,
                              new string[] { "anno", "semestre" },
                              new string[] { "ypay", "semesterpay" });
                    decimal payedamount = (CfgFn.GetNoNullDecimal(Pag["payedamount"]));
                    writer.WriteAttributeString("importo", sostituiscivirgolaconpunto(payedamount));
                    writer.WriteEndElement();
                }
            }
            else// se è un Dipendete non deve scrivere il semestre
            {
                foreach (DataRow Pag in tServicePayment.Select(filtropagamento, "semesterpay"))
                {
                    writer.WriteStartElement(tag);
                    writer.WriteAttributeString("anno", Pag["ypay"].ToString());
                    decimal payedamount = (CfgFn.GetNoNullDecimal(Pag["payedamount"]));
                    writer.WriteAttributeString("importo", sostituiscivirgolaconpunto(payedamount));
                    writer.WriteEndElement();
                }
            }
        }
예제 #5
0
        void FillDettagliMovSpesa()
        {
            DataRow linked = GetLinkedRow();

            if (linked == null)
            {
                txtCreditoreDebitore.Text = "";
                txtBilancio.Text          = "";
                txtDescrBilancio.Text     = "";
                txtResponsabile.Text      = "";
                txtImporto.Text           = "";
                txtNumeroRiga.Text        = "";
            }
            else
            {
                txtCreditoreDebitore.Text = linked["registry"].ToString();
                object newidfin = calcolaBilancioPerReversale(linked["idfin"]);

                DataTable tFin = Meta.Conn.RUN_SELECT("fin", null, null, QHS.CmpEq("idfin", newidfin), null, true);

                if (tFin.Rows.Count > 0)
                {
                    txtBilancio.Text      = tFin.Rows[0]["codefin"].ToString();
                    txtDescrBilancio.Text = tFin.Rows[0]["title"].ToString();
                }
                txtResponsabile.Text = linked["manager"].ToString();
                txtImporto.Text      = CfgFn.GetNoNullDecimal(linked["curramount"]).ToString("c");
                txtNumeroRiga.Text   = linked["nmov"].ToString();
            }
        }
예제 #6
0
        public override bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }

            int codicecreddeb = CfgFn.GetNoNullInt32(R["idreg"]);

            if (codicecreddeb <= 0)
            {
                errmess  = "Inserire l'anagrafica";
                errfield = "idreg";
                return(false);
            }

            decimal quota = CfgFn.GetNoNullDecimal(R["quota"]);

            if (quota <= 0 || quota > 1)
            {
                errmess  = "Quota non valida";
                errfield = "quota";
                return(false);
            }
            return(true);
        }
예제 #7
0
        public void MetaData_AfterFill()
        {
            FreshLogo();
            enableControls(false);

            decimal evaso;

            if (Meta.IsFirstFillForThisRow)
            {
                DataRow R = DS.bookingdetail.Rows[0];

                if (R["authorized"].ToString() == "S")
                {
                    decimal inevaso = CfgFn.GetNoNullDecimal(Conn.DO_READ_VALUE("booktotal",
                                                                                QHS.MCmp(R, "idstore", "idlist", "idbooking"),
                                                                                "number"));
                    decimal ordine = CfgFn.GetNoNullDecimal(R["number"]);
                    evaso = ordine - inevaso;
                }
                else
                {
                    evaso = 0;
                }
                txtEvaso.Text = evaso.ToString("n");

                if (R["authorized"] == DBNull.Value)
                {
                    chkAuthorizeed.Text = " In attesa di autorizzazione ";
                }
                else
                {
                    chkAuthorizeed.Text = " Autorizzato ";
                }
            }
        }
예제 #8
0
        private void calcolaCampiCalcolati()
        {
            if (DS.casualcontracttax.Rows.Count == 0)
            {
                return;
            }
            DataRow Curr            = DS.casualcontracttax.Rows[0];
            decimal imponibileNetto = CfgFn.GetNoNullDecimal(Curr["taxablenet"]);
            //object quotaNumImponibile = Curr["taxablenumerator"];
            //object quotaDenImponibile = Curr["taxabledenominator"];
            //decimal frazione = rapporto(quotaNumImponibile, quotaDenImponibile);
            //decimal imponibileNetto = CfgFn.RoundValuta(imponibile * frazione);
            //Curr["!imponibilenetto"] = imponibileNetto;
            //txtImponibileNetto.Text = imponibileNetto.ToString("c");

            decimal aliquotaAmmMedia = (imponibileNetto != 0)
                                ? CfgFn.GetNoNullDecimal(Curr["admintax"]) / imponibileNetto : 0;

            Curr["!aliquotaamm"] = aliquotaAmmMedia;
            txtAliquotaAmm.Text  = aliquotaAmmMedia.ToString("p6");

            decimal aliquotaDipMedia = (imponibileNetto != 0)
                                ? CfgFn.GetNoNullDecimal(Curr["employtax"]) / imponibileNetto : 0;

            Curr["!aliquotadip"] = aliquotaDipMedia;
            txtAliquotaDip.Text  = aliquotaDipMedia.ToString("p6");
        }
예제 #9
0
        public override bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }

            if (CfgFn.GetNoNullDecimal(R["amount"]) <= 0)
            {
                errmess  = "E' necessario specificare un importo positivo";
                errfield = "amount";
                return(false);
            }
            if (CfgFn.GetNoNullInt32(R["idreg"]) == 0)
            {
                errmess  = "Non è stata valorizzata un'anagrafica";
                errfield = "idreg";
                return(false);
            }
            if (CfgFn.GetNoNullInt32(R["nbill"]) == 0)
            {
                errmess  = "Non è stato valorizzato il numero del sospeso";
                errfield = "nbill";
                return(false);
            }
            return(true);
        }
예제 #10
0
        public static decimal TotaleImponibileNonEsenteSpese(DataTable Spesa, DataTable TipoSpesa, CfgItineration Cfg)
        {
            decimal      tot = 0;
            CQueryHelper QHC = new CQueryHelper();

            foreach (DataRow R in Spesa.Select())
            {
                object iditinerationrefundkind = R["iditinerationrefundkind"];
                if (iditinerationrefundkind == DBNull.Value)
                {
                    continue;
                }
                DataRow[] r = TipoSpesa.Select(QHC.CmpEq("iditinerationrefundkind", iditinerationrefundkind));
                if (r.Length == 0)
                {
                    continue;
                }
                if (CfgFn.GetNoNullInt32(r[0]["iditinerationrefundkindgroup"]) != 5)
                {
                    continue;                                                                  //non è un rimborso forfettario
                }
                decimal IndennitaTot = CfgFn.GetNoNullDecimal(R["amount"]);
                decimal QuotaEsente  = IF_QuotaEsente((DateTime)R["starttime"], (DateTime)R["stoptime"], Cfg, IndennitaTot);
                if ((IndennitaTot - QuotaEsente) > 0)
                {
                    tot += CfgFn.RoundValuta(IndennitaTot - QuotaEsente);
                }
            }
            return(tot);
        }
예제 #11
0
        /// <summary>
        /// Quota Esente Tappa EURO = (1-[perc.rid.quota esente])* [imp.esente] * [n. giorni fraz.]
        /// </summary>
        /// <param name="Missione"></param>
        /// <param name="Tappa"></param>
        /// <returns></returns>
        public static decimal QuotaEsenteTappa(DataRow Missione, DataRow Tappa, CfgItineration Cfg)
        {
            double  percquotaesentegg = CfgFn.GetNoNullDouble(Tappa["reductionpercentage"]);
            double  ggfraz            = GetNFrazionarioGiorni(Tappa);
            decimal QuotaEsente       = 0;

            if (TappaIsItalia(Tappa))
            {
                QuotaEsente = CfgFn.GetNoNullDecimal(Cfg.italianexemption);
            }
            else
            {
                QuotaEsente = CfgFn.GetNoNullDecimal(Cfg.foreignexemption);
            }
            if (percquotaesentegg > 1)
            {
                percquotaesentegg = 1;
            }
            decimal QuotaEsTappa = Convert.ToDecimal((1 - percquotaesentegg) * ggfraz) * QuotaEsente;

            QuotaEsTappa = CfgFn.RoundValuta(QuotaEsTappa);
            if (QuotaEsTappa > IndennitaTotale(Tappa))
            {
                QuotaEsTappa = IndennitaTotale(Tappa);
            }
            return(QuotaEsTappa);
        }
예제 #12
0
        public override bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }


            if (CfgFn.GetNoNullDecimal(R["idunderwriting"]) == 0)
            {
                errmess  = "Non è stato selezionato il finanziamento";
                errfield = "idunderwriting";
                return(false);
            }
            if (R["amount"] == DBNull.Value)
            {
                errmess  = "Non è stato immesso l'importo del finanziamento";
                errfield = "amount";
                return(false);
            }
            if (CfgFn.GetNoNullDecimal(R["amount"]) < 0)
            {
                errmess  = "L'importo non può essere negativo";
                errfield = "amount";
                return(false);
            }


            return(true);
        }
예제 #13
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["email"].ToString().Trim() != "")
            {
                Regex  emailregex = new Regex("(?<user>[^@]+)@(?<host>.+)");
                string s          = R["email"].ToString();

                Match m = emailregex.Match(s);

                if (!m.Success)
                {
                    errfield = "email";
                    errmess  = "Inserire correttamente l'indirizzo email nel seguente formato: [email protected]";
                    return(false);
                }
            }
            decimal deltapercentage = CfgFn.GetNoNullDecimal(R["deltapercentage"]);

            if (deltapercentage < 0 || deltapercentage > 1)
            {
                errmess  = "Percentuale non valida";
                errfield = "deltapercentage";
                return(false);
            }
            decimal deltaamount = CfgFn.GetNoNullDecimal(R["deltaamount"]);

            if (deltaamount < 0)
            {
                errmess  = "Importo non valido";
                errfield = "deltaamount";
                return(false);
            }

            if (R["isrequest"].ToString().ToUpper() == "S")
            {
                if (R["linktoinvoice"].ToString() != "N")
                {
                    errmess  = "Una richiesta d'ordine non è associabile a fattura";
                    errfield = "linktoinvoice";
                    return(false);
                }
                if (R["linktoasset"].ToString() != "N")
                {
                    errmess  = "Una richiesta d'ordine non è utilizzabile con il carico cespite";
                    errfield = "linktoasset";
                    return(false);
                }
                if (R["multireg"].ToString() != "N")
                {
                    errmess  = "Una richiesta d'ordine non può avere l'anagrafe nel dettaglio";
                    errfield = "multireg";
                    return(false);
                }
            }
            return(true);
        }
예제 #14
0
        public decimal GetMassimaleRitenuta()
        {
            DataRow   Curr = RCasualContract;
            string    filtroPrestazione        = QHS.CmpEq("idser", Curr["idser"]);
            DataTable ritenuteDellaPrestazione = DataAccess.RUN_SELECT(Conn, "servicetaxview",
                                                                       "taxcode,taxkind", "taxcode", filtroPrestazione, null, null, true);

            DataRow[] rInps = ritenuteDellaPrestazione.Select(QHS.CmpEq("taxkind", 3));
            if ((rInps.Length) == 0)
            {
                return(0);
            }

            object taxcode           = rInps[0]["taxcode"]; // codice della ritenuta previdenziale
            object datadaconsiderare = (DateTime)Conn.GetSys("datacontabile");
            // Determina la più recente struttura aliquote
            object maxIdTaxRateStart = Conn.DO_READ_VALUE("taxratestart",
                                                          QHS.AppAnd(QHS.CmpLe("start", datadaconsiderare),
                                                                     QHS.CmpEq("taxcode", taxcode)), "max(idtaxratestart)");

            // Determina il massimale della struttura  aliquote considerata
            object maxamount = Conn.DO_READ_VALUE("taxratebracket",
                                                  QHS.AppAnd(QHS.CmpEq("idtaxratestart", maxIdTaxRateStart),
                                                             QHS.CmpEq("taxcode", taxcode)), "max(maxamount)");

            return(CfgFn.GetNoNullDecimal(maxamount));
        }
예제 #15
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);
        }
예제 #16
0
        private void CalcolaTotali()
        {
            if ((DS.invoice.Rows.Count) == 0)
            {
                return;
            }
            DataRow Curr        = DS.invoice.Rows[0];
            decimal tassocambio = RoundDecimal6(CfgFn.GetNoNullDecimal(Curr["exchangerate"]));

            decimal imponibile    = 0;
            decimal imponibileEur = 0;
            decimal imposta       = 0;
            decimal indetraibile  = 0;
            decimal totale        = 0;

            foreach (DataRow R in DS.invoicedetail.Rows)
            {
                if (R.RowState == DataRowState.Deleted)
                {
                    continue;
                }
                decimal R_imponibile = CfgFn.GetNoNullDecimal(R["taxable"]);
                decimal R_quantita   = CfgFn.GetNoNullDecimal(R["npackage"]);
                decimal R_sconto     = RoundDecimal6(CfgFn.GetNoNullDecimal(R["discount"]));
                imponibile   += CfgFn.RoundValuta((R_imponibile * R_quantita * (1 - R_sconto)) * tassocambio);
                imposta      += CfgFn.RoundValuta(CfgFn.GetNoNullDecimal(R["tax"]));
                indetraibile += CfgFn.RoundValuta(CfgFn.GetNoNullDecimal(R["unabatable"]));
            }
            imponibileEur      = CfgFn.RoundValuta(imponibile);
            totale             = imponibileEur + imposta;
            txtImponibile.Text = imponibileEur.ToString("c");
            txtImposta.Text    = imposta.ToString("c");
            txtTotale.Text     = totale.ToString("c");
            txtImpDeduc.Text   = indetraibile.ToString("c");
        }
예제 #17
0
        public void MetaData_AfterRowSelect(DataTable T, DataRow R)
        {
            if (!Meta.DrawStateIsDone)
            {
                return;
            }
            DataRow Curr = DS.entrydetailaccrual.Rows[0];

            if (T.TableName == "entrydetailaccrualview")
            {
                if (R != null)
                {
                    decimal N = CfgFn.GetNoNullDecimal(R["available"]);
                    if (CfgFn.GetNoNullDecimal(parentRow["amount"]) > 0)
                    {
                        if (R["flagap"].ToString() == "P")
                        {
                            N = -N;                                //il segno normale sarebbe dovuto essere una A (rateo attivo)
                        }
                    }
                    else
                    {
                        if (R["flagap"].ToString() == "A")
                        {
                            N = -N;                               //il segno normale sarebbe dovuto essere una P (rateo passivo)
                        }
                    }
                    Curr["amount"]  = N;
                    txtImporto.Text = N.ToString("c");
                }
            }
        }
예제 #18
0
        decimal calcolaProrata(DataTable t)
        {
            decimal numerator   = 0;
            decimal denominator = 0;
            decimal prorata     = 0;

            foreach (DataRow rDetail in t.Rows)
            {
                if (rDetail["numerator"].ToString() == "S")
                {
                    numerator += CfgFn.GetNoNullDecimal(rDetail["taxabletotal"]);
                }
                if (rDetail["denominator"].ToString() == "S")
                {
                    denominator += CfgFn.GetNoNullDecimal(rDetail["taxabletotal"]);
                }
            }
            if (denominator != 0)
            {
                prorata = CfgFn.Round((numerator / denominator), 2);
            }
            else
            {
                prorata = 0;
            }
            return(prorata);
        }
예제 #19
0
        private void btnEditClass_Click(object sender, System.EventArgs e)
        {
            if (Meta.IsEmpty)
            {
                return;
            }
            if (DS.admpay_income.Rows.Count == 0)
            {
                return;
            }
            Meta.GetFormData(true);
            DataRow Curr    = DS.admpay_income.Rows[0];
            decimal importo = CfgFn.GetNoNullDecimal(Curr["amount"]);

            CalcImpClassMovDefaults(importo);

            DataTable T;
            DataRow   CurrTipoClass;
            bool      res = Meta.myHelpForm.GetCurrentRow(DGridClassificazioni, out T, out CurrTipoClass);

            if (!res)
            {
                return;
            }
            if (CurrTipoClass == null)
            {
                return;
            }
            DataTable SourceTable;
            DataRow   CurrDR;

            res = Meta.myHelpForm.GetCurrentRow(DGridDettagliClassificazioni, out SourceTable, out CurrDR);
            if (!res)
            {
                return;
            }
            if (CurrDR == null)
            {
                return;
            }

            string    filter          = QHS.CmpEq("idsorkind", CurrTipoClass["idsorkind"]);
            DataTable ClassMovAllowed = DS.sorting.Clone();

            ClassMovAllowed.Clear();
            Meta.Conn.RUN_SELECT_INTO_TABLE(ClassMovAllowed, null, filter, null, true);
            if (ClassMovAllowed.Rows.Count == 0)
            {
                return;
            }
            DS.admpay_incomesorted.ExtendedProperties[MetaData.ExtraParams] = ClassMovAllowed;
            DataRow Modified = MetaData.Edit_Grid(DGridDettagliClassificazioni, "detail");

            if (Modified == null)
            {
                return;
            }

            Meta.FreshForm(true);
        }
예제 #20
0
 public override bool IsValid(DataRow R, out string errmess, out string errfield)
 {
     if (!base.IsValid(R, out errmess, out errfield))
     {
         return(false);
     }
     if (CfgFn.GetNoNullDecimal(R["quota"]) == 0)
     {
         errmess  = "Non è stata valorizzata la quota";
         errfield = "quota";
         return(false);
     }
     if (CfgFn.GetNoNullInt32(R["idfin"]) == 0)
     {
         errmess  = "Non è stato valorizzato il capitolo";
         errfield = "idfin";
         return(false);
     }
     if (R["idupb"] == DBNull.Value)
     {
         errmess  = "Non è stato valorizzato l'UPB";
         errfield = "idupb";
         return(false);
     }
     return(true);
 }
예제 #21
0
 private void scriviXml(DataRow row, string[] col, string[] sourcecol)
 {
     for (int i = 0; i < col.Length; i++)
     {
         string c      = col[i];
         string source = sourcecol[i];
         if (!(row[source] is DBNull))
         {
             if (row[source] is DateTime)
             {
                 //lavora i DateTime
                 DateTime d = (DateTime)row[source];
                 writer.WriteAttributeString(c.ToString(), d.ToString("yyyy-MM-dd"));
             }
             else
             {
                 if (row[source] is Decimal)
                 {
                     // Lavora i decimali
                     decimal amount = CfgFn.GetNoNullDecimal(row[source]);
                     writer.WriteAttributeString(c.ToString(), sostituiscivirgolaconpunto(amount));
                 }
                 else
                 {
                     //Tutto il resto
                     writer.WriteAttributeString(c, row[source].ToString());
                 }
             }
         }
     }
 }
예제 #22
0
        private decimal calcolaImportoDaEsitare(DataRow rSpesa)
        {
            decimal importoCorrente = CfgFn.GetNoNullDecimal(rSpesa["curramount"]);

            DataRow rMandato = Meta.SourceRow.GetParentRow("paymentbanktransaction");

            if (rMandato == null)
            {
                return(-1);
            }
            DataRow [] rEsiti = rMandato.GetChildRows("paymentbanktransaction");

            DataRow Curr = DS.banktransaction.Rows[0];
            decimal importoGiaEsitato = 0;

            foreach (DataRow rEsito in rEsiti)
            {
                if ((rEsito["idexp"].ToString() == Curr["idexp"].ToString()) &&
                    (rEsito["kpay"].ToString() == Curr["kpay"].ToString()))
                {
                    if (                    //(Meta.EditMode) &&
                        (rEsito["nban"].ToString() == Curr["nban"].ToString()))
                    {
                        continue;
                    }
                    importoGiaEsitato += CfgFn.GetNoNullDecimal(rEsito["amount"]);
                }
            }

            importoCorrente -= importoGiaEsitato;
            return(importoCorrente);
        }
예제 #23
0
        void EffettuaCalcoli()
        {
            if (Meta.IsEmpty)
            {
                return;
            }
            DataRow r = DS.bill.Rows[0];

            //valore iniziale di default
            decimal start  = CfgFn.GetNoNullDecimal(r["total"]);
            decimal storni = CfgFn.GetNoNullDecimal(r["reduction"]);


            //if (DS.bankimportbill.Rows.Count > 0) {
            //    storni = 0;
            //    start = 0;
            //    foreach(DataRow op in DS.bankimportbill.Select(null,"adate asc")){
            //        decimal amount = CfgFn.GetNoNullDecimal(op["amount"]);
            //        if (amount > 0) {
            //            start += amount;
            //        }
            //        else {
            //            storni -= amount;
            //        }
            //    }
            //}

            decimal importo_corrente = start - storni;


            decimal esiti = 0;

            foreach (DataRow op in DS.billtransaction.Select())
            {
                esiti += CfgFn.GetNoNullDecimal(op["amount"]);
            }
            //per retrocompatibilità
            if (r["active"].ToString().ToUpper() == "N")
            {
                esiti = importo_corrente;
            }

            decimal da_regolarizzare = importo_corrente - esiti;

            if (storni != 0)
            {
                txtStorni.Text = storni.ToString("c");
            }
            else
            {
                if (txtStorni.Text != "")
                {
                    txtStorni.Text = storni.ToString("c");
                }
            }
            txtEsiti.Text     = esiti.ToString("c");
            txtDaEsitare.Text = da_regolarizzare.ToString("c");

            txtImportoCorrente.Text = importo_corrente.ToString("c");
        }
예제 #24
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);
        }
예제 #25
0
        private decimal GetSaldoPrecedente12()
        {
            DataRow R = DS.mainivapay.Rows[0];

            object esercizio = Meta.GetSys("esercizio");

            string sql = "SELECT SUM(paymentamount12) as paymentamount12,"
                         + " SUM(refundamount12) as refundamount12, "
                         + " SUM(totaldebit12) as totaldebit12,"
                         + " SUM(totalcredit12) as totalcredit12 "
                         + "FROM mainivapay ";
            string filter = " WHERE " + QHS.AppAnd(
                QHS.CmpEq("ymainivapay", R["ymainivapay"]), QHS.CmpLt("nmainivapay", R["nmainivapay"]));
            DataTable T = Conn.SQLRunner(sql + filter, false);

            decimal saldo_precedente12 = -startivabalance12;

            if (T != null && T.Rows.Count > 0)
            {
                DataRow RR = T.Rows[0];
                saldo_precedente12 = saldo_precedente12
                                     + CfgFn.GetNoNullDecimal(R["totaldebit12"])
                                     - CfgFn.GetNoNullDecimal(R["paymentamount12"])

                                     - CfgFn.GetNoNullDecimal(R["totalcredit12"])
                                     + CfgFn.GetNoNullDecimal(R["refundamount12"]);
            }
            return(saldo_precedente12);
        }
예제 #26
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);
        }
예제 #27
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");
            }
        }
예제 #28
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");
        }
예제 #29
0
        public void MetaData_AfterFill()
        {
            EPM.mostraEtichette();
            txtDataA.ReadOnly       = true;
            txtDataDa.ReadOnly      = true;
            txtDataCont.ReadOnly    = true;
            txtTotRitenute.ReadOnly = true;
            txtImporto.ReadOnly     = true;

            decimal totale = CfgFn.GetNoNullDecimal(
                DS.taxpayexpenseview.Compute("SUM(curramount)",
                                             QHC.CmpEq("nphase", Conn.GetSys("maxexpensephase"))));

            try {
                txtMovSpesa.Text = totale.ToString("C");
            }
            catch (Exception E) {
                MessageBox.Show(E.Message);
            }

            decimal totrit = MetaData.SumColumn(DS.payedtaxview, "employtax") +
                             MetaData.SumColumn(DS.payedtaxview, "admintax") +
                             MetaData.SumColumn(DS.expensetaxcorrigeview, "employamount") +
                             MetaData.SumColumn(DS.expensetaxcorrigeview, "adminamount");

            txtTotRitenute.Text = totrit.ToString("C");
        }
예제 #30
0
        public bool RitenuteFiscaliApplicabili()
        {
            var lordo = CfgFn.GetNoNullDecimal(RCasualContract["feegross"]);
            var spese = totSpese("F") + totSpese("P");

            return(spese != lordo);
        }