private void btnSpesa_Click(object sender, System.EventArgs e) { if (Meta.IsEmpty) { return; } Meta.GetFormData(true); DataTable Fasi2 = DS.expensephase.Copy(); string filterPhase = QHC.AppOr(QHC.CmpEq("nphase", Meta.GetSys("maxexpensephase")), QHC.CmpLt("nphase", Meta.GetSys("expensefinphase"))); foreach (DataRow ToDel in Fasi2.Select(filterPhase)) { ToDel.Delete(); } Fasi2.AcceptChanges(); DataRow Curr = DS.admpay_appropriation.Rows[0]; decimal importo = CfgFn.GetNoNullDecimal(Curr["amount"]); var f = new AskInfo.FrmAskInfo(Meta, "S", true); f.EnableFilterAvailable(importo); f.allowSelectPhase("Seleziona la fase del movimento a cui collegare il pagamento degli stipendi"); f.askUpbAs("UPB da associare ai dettagli ai quali non è stato attribuito"); //FrmAskFase F = new FrmAskFase("S", importo, Fasi2, DS.upb, DS.finview, Meta.Dispatcher, Meta.Conn); if (f.ShowDialog() != DialogResult.OK) { return; } int selectedfase = CfgFn.GetNoNullInt32(f.GetFaseMovimento()); //F.cmbFasi.SelectedValue string filter = ""; string filterUpb = QHS.CmpEq("idupb", "0001"); string filterFin = ""; if (selectedfase > 0) { filter = GetData.MergeFilters(filter, QHS.CmpEq("nphase", selectedfase)); } // Aggiunta filtro dell'UPB e del Bilancio object idupb = f.GetUPB(); if (idupb != DBNull.Value) { filterUpb = QHS.CmpEq("idupb", idupb); } object idfin = f.GetFin(); if (idfin != DBNull.Value) { filterFin = QHS.CmpEq("idfin", idfin); } filter = GetData.MergeFilters(filter, filterUpb); if (filterFin != "") { filter = GetData.MergeFilters(filter, filterFin); } if (importo > 0) { filter = GetData.MergeFilters(filter, QHS.CmpGe("available", importo)); } else { filter = GetData.MergeFilters(filter, QHS.CmpGt("available", 0)); } int faseScelta = selectedfase; int faseRegistry = CfgFn.GetNoNullInt32(Meta.GetSys("expenseregphase")); if (faseScelta >= faseRegistry) { filter = QHS.AppAnd(filter, filterOnReg); } MetaData E = Meta.Dispatcher.Get("expense"); E.FilterLocked = true; E.DS = DS.Clone(); DataRow Choosen = E.SelectOne("default", filter, "expense", null); if (Choosen == null) { lastIdExp = DBNull.Value; return; } Curr["idexp"] = Choosen["idexp"]; if (!lastIdExp.Equals(Choosen["idexp"])) { ricalcolaImporto(Choosen["available"]); } lastIdExp = Choosen["idexp"]; DS.expenseview.Clear(); Meta.Conn.RUN_SELECT_INTO_TABLE(DS.expenseview, null, QHS.AppAnd(QHS.CmpEq("idexp", Curr["idexp"]), QHS.CmpEq("ayear", Meta.GetSys("esercizio"))), null, true); Meta.FreshForm(false); }
private void btnEntrata_Click(object sender, EventArgs e) { if (Meta.IsEmpty) { return; } Meta.GetFormData(true); DataTable Fasi2 = DS.incomephase.Copy(); string filterPhase = QHC.AppOr(QHC.CmpEq("nphase", Meta.GetSys("maxincomephase")), QHC.CmpLt("nphase", Meta.GetSys("incomefinphase"))); foreach (DataRow ToDel in Fasi2.Select(filterPhase)) { ToDel.Delete(); } Fasi2.AcceptChanges(); DataRow Curr = DS.admpay_assessment.Rows[0]; decimal importo = CfgFn.GetNoNullDecimal(Curr["amount"]); var f = new FrmAskInfo(Meta, "E", true).SetUPB("0001").EnableManagerSelection(false); if (importo > 0) { f.EnableFilterAvailable(importo); } f.allowSelectPhase("Seleziona la fase del movimento a cui collegare il pagamento degli stipendi"); if (f.ShowDialog(this) != DialogResult.OK) { return; } var selectedfase = Convert.ToInt32(f.GetFaseMovimento()); string filter = ""; string filterUpb = QHS.CmpEq("idupb", "0001"); string filterFin = ""; if (selectedfase > 0) { filter = GetData.MergeFilters(filter, QHS.CmpEq("nphase", selectedfase)); } // Aggiunta filtro dell'UPB e del Bilancio if (f.GetUPB() != DBNull.Value) { filterUpb = QHS.CmpEq("idupb", f.GetUPB()); if (f.GetFin() != DBNull.Value) { filterFin = QHS.CmpEq("idfin", f.GetFin()); } } filter = GetData.MergeFilters(filter, filterUpb); if (filterFin != "") { filter = GetData.MergeFilters(filter, filterFin); } filter = GetData.MergeFilters(filter, importo > 0 ? QHS.CmpGe("available", importo) : QHS.CmpGt("available", 0)); int faseScelta = CfgFn.GetNoNullInt32(f.GetFaseMovimento()); int faseRegistry = CfgFn.GetNoNullInt32(Meta.GetSys("expenseregphase")); if (faseScelta >= faseRegistry) { filter = QHS.AppAnd(filter, filterOnReg); } MetaData E = Meta.Dispatcher.Get("income"); E.FilterLocked = true; E.DS = DS.Clone(); DataRow Choosen = E.SelectOne("default", filter, "income", null); if (Choosen == null) { lastIdInc = DBNull.Value; return; } Curr["idinc"] = Choosen["idinc"]; if (!lastIdInc.Equals(Choosen["idinc"])) { ricalcolaImporto(Choosen["available"]); } lastIdInc = Choosen["idinc"]; DS.incomeview.Clear(); Meta.Conn.RUN_SELECT_INTO_TABLE(DS.incomeview, null, QHS.AppAnd(QHS.CmpEq("idinc", Curr["idinc"]), QHS.CmpEq("ayear", Meta.GetSys("esercizio"))), null, true); Meta.FreshForm(false); }