private void btnListino_Click(object sender, EventArgs e) { if (Meta.IsEmpty) { return; } DataRow Curr = DS.stock.Rows[0]; string filter = QHS.DoPar(QHS.AppOr(QHS.IsNull("validitystop"), QHS.CmpGe("validitystop", Meta.GetSys("datacontabile")))); MetaData Mlistino = MetaData.GetMetaData(this, "listview"); Mlistino.FilterLocked = true; Mlistino.DS = DS.Clone(); DataRow Choosen = Mlistino.SelectOne("default", filter, "listview", null); if (Choosen == null) { return; } Curr["idlist"] = Choosen["idlist"]; riempiOggetti(Choosen); return; }
private void btnCasuale_Click(object sender, EventArgs e) { object idpccdebitstatus = DBNull.Value; string filter = ""; if (cmbStatodelDebito.SelectedIndex > 0) { idpccdebitstatus = cmbStatodelDebito.SelectedValue; } if (idpccdebitstatus != DBNull.Value) { int maskorder = CfgFn.GetNoNullInt32(DS.pccdebitstatus.Select(QHC.CmpEq("idpccdebitstatus", idpccdebitstatus))[0]["flag"]); filter = "( flagstatus & " + QueryCreator.unquotedstrvalue(maskorder, true) + " <>0 )"; } MetaData MCausali = MetaData.GetMetaData(this, "pccdebitmotive"); MCausali.FilterLocked = true; MCausali.DS = DS.Clone(); DataRow Choosen = MCausali.SelectOne("default", filter, "pccdebitmotive", null); if (Choosen == null) { return; } txtCodiceCasualePcc.Text = Choosen["idpccdebitmotive"].ToString(); txtCausale.Text = Choosen["description"].ToString(); }
private void txtListino_Leave(object sender, EventArgs e) { if (Meta == null) { return; } if (!Meta.DrawStateIsDone) { return; } if (txtListino.Text == "") { svuotaOggetti(); return; } if (txtListino.Text == lastCodice) { return; } string filter = QHS.DoPar(QHS.AppOr(QHS.IsNull("validitystop"), QHS.CmpGe("validitystop", Meta.GetSys("datacontabile")))); string IntCode = txtListino.Text; if (!IntCode.EndsWith("%")) { IntCode += "%"; } filter = GetData.MergeFilters(filter, QHS.Like("intcode", IntCode)); filter = QHS.AppAnd(filter, QHS.NullOrEq("active", "S")); if (VeroTipoFatturaAV() == "A") { filter = QHS.AppAnd(filter, QHS.BitSet("flagvisiblekind", 1)); //bit 1: visibile nei c. passivi. BitSet confronta con <> 0 } else { filter = QHS.AppAnd(filter, QHS.BitSet("flagvisiblekind", 2)); //bit 2: visibile nei c. attivi } MetaData Mlistino = MetaData.GetMetaData(this, "listview"); Mlistino.FilterLocked = true; Mlistino.DS = DS.Clone(); DataRow Choosen = Mlistino.SelectOne("default", filter, "listview", null); if (Choosen == null) { txtListino.Focus(); lastCodice = null; return; } riempiOggetti(Choosen); }
private void btnListino_Click(object sender, EventArgs e) { string filter = QHS.DoPar(QHS.AppOr(QHS.IsNull("validitystop"), QHS.CmpGe("validitystop", Meta.GetSys("datacontabile")))); MetaData Mlistino = MetaData.GetMetaData(this, "listview"); Mlistino.FilterLocked = true; Mlistino.DS = DS.Clone(); if (chkListDescription.Checked) { FrmAskDescr FR = new FrmAskDescr(Meta.Dispatcher); DialogResult D = FR.ShowDialog(this); if (D != DialogResult.OK) { return; } if (FR.Selected != null) { object idlistclass = FR.Selected["idlistclass"]; filter = QHS.AppAnd(filter, QHS.CmpEq("idlistclass", FR.Selected["idlistclass"])); } if (FR.txtDescrizione.Text != "") { string Description = FR.txtDescrizione.Text; if (!Description.EndsWith("%")) { Description += "%"; } if (!Description.StartsWith("%")) { Description = "%" + Description; } filter = QHS.AppAnd(filter, QHS.Like("description", Description)); } } DataRow Choosen = Mlistino.SelectOne("default", filter, "listview", null); if (Choosen == null) { return; } riempiOggetti(Choosen); if (Meta.IsEmpty) { return; } DataRow Curr = DS.stock.Rows[0]; Curr["idlist"] = Choosen["idlist"]; }
private void btnListino_Click(object sender, EventArgs e) { string filter = QHS.DoPar(QHS.AppOr(QHS.IsNull("validitystop"), QHS.CmpGe("validitystop", Meta.GetSys("datacontabile")))); MetaData Mlistino = MetaData.GetMetaData(this, "listview"); Mlistino.FilterLocked = true; Mlistino.DS = DS.Clone(); if (chkListDescription.Checked) { FrmAskDescr FR = new FrmAskDescr(Meta.Dispatcher); DialogResult D = FR.ShowDialog(this); if (D != DialogResult.OK) { return; } if (FR.Selected != null) { object idlistclass = FR.Selected["idlistclass"]; filter = QHC.AppAnd(filter, QHC.CmpEq("idlistclass", FR.Selected["idlistclass"])); } if (FR.txtDescrizione.Text != "") { string Description = FR.txtDescrizione.Text; if (!Description.EndsWith("%")) { Description += "%"; } if (!Description.StartsWith("%")) { Description = "%" + Description; } filter = QHC.AppAnd(filter, QHC.Like("description", Description)); } } if (VeroTipoFatturaAV() == "A") { filter = QHS.AppAnd(filter, QHS.BitSet("flagvisiblekind", 1)); //bit 1: visibile nei c. passivi. BitSet confronta con <> 0 } else { filter = QHS.AppAnd(filter, QHS.BitSet("flagvisiblekind", 2)); //bit 2: visibile nei c. attivi } DataRow Choosen = Mlistino.SelectOne("default", filter, "listview", null); if (Choosen == null) { return; } riempiOggetti(Choosen); return; }
private void txtListino_Leave(object sender, EventArgs e) { if (txtListino.Text == "") { svuotaOggetti(); return; } string filter = ""; if (Meta.InsertMode || Meta.EditMode) { filter = QHS.DoPar(QHS.AppOr(QHS.IsNull("validitystop"), QHS.CmpGe("validitystop", Meta.GetSys("datacontabile")))); } string IntCode = txtListino.Text; if (!IntCode.EndsWith("%")) { IntCode += "%"; } filter = GetData.MergeFilters(filter, QHS.Like("intcode", IntCode)); MetaData Mlistino = MetaData.GetMetaData(this, "listview"); Mlistino.FilterLocked = true; Mlistino.DS = DS.Clone(); DataRow Choosen = Mlistino.SelectOne("default", filter, "listview", null); if (Choosen == null) { return; } riempiOggetti(Choosen); if (DS.stock.Rows.Count == 0) { return; } if (!Meta.DrawStateIsDone) { return; } DataRow Curr = DS.stock.Rows[0]; Curr["idlist"] = Choosen["idlist"]; return; }
private void btnListino_Click(object sender, EventArgs e) { string filter = ""; MetaData Mlistino = MetaData.GetMetaData(this, "listview"); if (!Meta.IsEmpty) { Meta.GetFormData(true); } Mlistino.FilterLocked = true; Mlistino.DS = DS.Clone(); if (chkListDescription.Checked) { FrmAskDescr FR = new FrmAskDescr(Meta.Dispatcher); DialogResult D = FR.ShowDialog(this); if (D != DialogResult.OK) { return; } if (FR.Selected != null) { object idlistclass = FR.Selected["idlistclass"]; filter = QHC.AppAnd(filter, QHC.CmpEq("idlistclass", FR.Selected["idlistclass"])); } if (FR.txtDescrizione.Text != "") { string Description = FR.txtDescrizione.Text; if (!Description.EndsWith("%")) { Description += "%"; } if (!Description.StartsWith("%")) { Description = "%" + Description; } filter = QHC.AppAnd(filter, QHC.Like("description", Description)); } } filter = QHS.AppAnd(filter, QHS.BitSet("flagvisiblekind", 2)); DataRow Choosen = Mlistino.SelectOne("default", filter, "listview", null); if (Choosen == null) { return; } riempiOggetti(Choosen); return; }
private void txtListino_Leave(object sender, EventArgs e) { if (txtListino.Text == "") { svuotaOggetti(); return; } if (txtListino.Text == lastCodice) { return; } if (!Meta.IsEmpty) { Meta.GetFormData(true); } string filter = ""; string IntCode = txtListino.Text; if (!IntCode.EndsWith("%")) { IntCode += "%"; } filter = GetData.MergeFilters(filter, QHS.Like("intcode", IntCode)); filter = QHS.AppAnd(filter, QHS.BitSet("flagvisiblekind", 2)); //bit 2: visibile nei c. attivi MetaData Mlistino = MetaData.GetMetaData(this, "listview"); Mlistino.FilterLocked = true; Mlistino.DS = DS.Clone(); DataRow Choosen = Mlistino.SelectOne("default", filter, "listview", null); if (Choosen == null) { txtListino.Focus(); lastCodice = null; return; } riempiOggetti(Choosen); }
private void txtFromRegistry_Leave(object sender, EventArgs e) { if (inChiusura) { return; } if (txtFromRegistry.Text == "") { return; } if (DS.paydispositiondetail.Rows.Count == 0) { return; } PulisciCampi();// Se ho scelto un'altra anagrafica devo prima pulire i campi. string reg = txtFromRegistry.Text; if (!reg.EndsWith("%")) { reg += "%"; } if (chkFlaghuman.Checked) {// E' persona fisica il comportamento non cambia string filter = QHS.AppAnd(QHS.Like("title", reg), QHS.CmpEq("human", 'S')); DataTable tRegistry = DataAccess.CreateTableByName(Meta.Conn, "registrymainview", "*"); DataAccess.RUN_SELECT_INTO_TABLE(Meta.Conn, tRegistry, null, filter, null, true); if (tRegistry.Rows.Count == 0) { MessageBox.Show(this, "Nessuna anagrafica trovata in archivio"); return; } MetaData MetaRegistry = MetaData.GetMetaData(this, "registry"); MetaRegistry.FilterLocked = true; MetaRegistry.DS = DS.Clone(); DataRow R = MetaRegistry.SelectOne("default", filter, null, null); if (R == null) { return; } DataRow Curr = DS.paydispositiondetail.Rows[0]; bool isItaliano = valutaSeItaliano(R["idcity"], R["idnation"]); chkItaliano.Checked = isItaliano; Curr["surname"] = R["surname"]; Curr["forename"] = R["forename"]; Curr["idcity"] = R["idcity"]; Curr["idnation"] = R["idnation"]; Curr["birthdate"] = R["birthdate"]; Curr["cf"] = R["cf"]; Curr["gender"] = R["gender"]; object idReg = R["idreg"]; string filterReg = QHS.CmpEq("idreg", idReg); //Legge l'indirizzo DataTable tRegistryAddress = DataAccess.CreateTableByName(Meta.Conn, "registryaddress", "*"); object idPred = ottieniIdIndirizzoPredefinito(); if ((idPred != null) && (idPred != DBNull.Value)) { riempiRegistryAddress(tRegistryAddress, idReg, idPred); if ((tRegistryAddress != null) && (tRegistryAddress.Rows.Count != 0)) { DataRow rRA = tRegistryAddress.Rows[0]; string address = calcolaAddress(rRA["address"]); if (address != null) { Curr["address"] = address;// rRA["address"]; } Curr["cap"] = rRA["cap"]; string province; object location = calcolaLocation(rRA, out province); if (location != null) { Curr["location"] = location; Curr["province"] = province; } } } //Legge le coordinate bancarie dalla mod. di pag. predefinita, ove ci sia l'IBAN CalcolaValoriDefaultModPagamento(idReg, Curr); Curr["flaghuman"] = 'S'; txtFromRegistry.Text = R["title"].ToString(); } else // Non è persona fisica { string filter = QHS.AppAnd(QHS.Like("title", reg), QHS.CmpNe("human", 'S')); DataTable tRegistry = DataAccess.CreateTableByName(Meta.Conn, "registrymainview", "*"); DataAccess.RUN_SELECT_INTO_TABLE(Meta.Conn, tRegistry, null, filter, null, true); if (tRegistry.Rows.Count == 0) { MessageBox.Show(this, "Nessuna anagrafica trovata in archivio"); return; } MetaData MetaRegistry = MetaData.GetMetaData(this, "registry"); MetaRegistry.FilterLocked = true; MetaRegistry.DS = DS.Clone(); DataRow R = MetaRegistry.SelectOne("default", filter, null, null); if (R == null) { return; } DataRow Curr = DS.paydispositiondetail.Rows[0]; Curr["title"] = R["title"]; Curr["cf"] = R["cf"]; Curr["p_iva"] = R["p_iva"]; object idReg = R["idreg"]; string filterReg = QHS.CmpEq("idreg", idReg); //Legge l'indirizzo DataTable tRegistryAddress = DataAccess.CreateTableByName(Meta.Conn, "registryaddress", "*"); object idPred = ottieniIdIndirizzoPredefinito(); if ((idPred != null) && (idPred != DBNull.Value)) { riempiRegistryAddress(tRegistryAddress, idReg, idPred); if ((tRegistryAddress != null) && (tRegistryAddress.Rows.Count != 0)) { DataRow rRA = tRegistryAddress.Rows[0]; string address = calcolaAddress(rRA["address"]); if (address != null) { Curr["address"] = address;// rRA["address"]; } Curr["cap"] = rRA["cap"]; string province; object location = calcolaLocation(rRA, out province); if (location != null) { Curr["location"] = location; Curr["province"] = province; } } } //Legge le coordinate bancarie dalla mod. di pag. predefinita, ove ci sia l'IBAN CalcolaValoriDefaultModPagamento(idReg, Curr); Curr["flaghuman"] = 'N'; txtFromRegistry.Text = R["title"].ToString(); } Meta.FreshForm(); }
bool Do_Delete() { pBar.Visible = true; this.Cursor = Cursors.WaitCursor; foreach (DataTable T in DS.Tables) { if ((T.TableName == "registrymainview") || (T.TableName == "no_table")) { continue; } T.Clear(); } string dataMember = dgAnagrafica.DataMember; CurrencyManager cm = dgAnagrafica.BindingContext[DS, dataMember] as CurrencyManager; if (cm == null) { return(false); } DataView view = cm.List as DataView; if (view == null) { MessageBox.Show(this, "Selezionare almeno una anagrafica"); return(true); } int Nselected = 0; int max = view.Count - 1; for (int i = 0; i <= max; i++) { if (dgAnagrafica.IsSelected(i)) { Nselected++; } } pBar.Maximum = Nselected; pBar.Value = 0; string filter = ""; //int j = 0; for (int i = 0; i <= max; i++) { if (!dgAnagrafica.IsSelected(i)) { continue; } DataSet D = DS.Clone(); QueryCreator.SetTableForPosting(D.Tables["registrymainview"], "registry"); pBar.Increment(1); filter = QHS.CmpEq("idreg", view[i]["idreg"]); foreach (string tname in new string[] { "registrymainview", "registryaddress", "registrycf", "registrylegalstatus", "registrypaymethod", "registrypiva", "registryreference", "registrytaxablestatus" }) { DataAccess.RUN_SELECT_INTO_TABLE(Meta.Conn, D.Tables[tname], null, filter, null, false); foreach (DataRow RD in D.Tables[tname].Rows) { RD.Delete(); } } PostData P = Meta.Get_PostData(); P.InitClass(D, Meta.Conn); if (!P.DO_POST()) { Aggiorna(); pBar.Visible = false; return(false); } } Aggiorna(); this.Cursor = Cursors.Default; pBar.Visible = false; return(true); }
/// <summary> /// Metodo che consente la selezione del movimento finanziario /// </summary> /// <param name="E_S"></param> private void selezionaMovimento(string E_S) { if (Meta.IsEmpty) { return; } Meta.GetFormData(true); string filterPhase = (E_S == "E") ? QHC.CmpEq("nphase", Meta.GetSys("maxincomephase")) : QHC.CmpEq("nphase", Meta.GetSys("maxexpensephase")); DataRow Curr = DS.expensetaxcorrige.Rows[0]; decimal importo = (E_S == "E") ? -(CfgFn.GetNoNullDecimal(Curr["employamount"]) + CfgFn.GetNoNullDecimal(Curr["adminamount"])) : CfgFn.GetNoNullDecimal(Curr["employamount"]) + CfgFn.GetNoNullDecimal(Curr["adminamount"]); //DataTable tUpb = DataAccess.RUN_SELECT(Meta.Conn, "upb", "*", null, QHS.CmpEq("idupb", "0001"), // null, null, true); //string flag = (E_S == "E") ? QHS.BitClear("flag", 0) : QHS.BitSet("flag", 0); //DataTable tFinView = DataAccess.RUN_SELECT(Meta.Conn, "finview", "*", null, // QHS.AppAnd(QHS.CmpEq("idupb", "0001"), QHS.CmpEq("ayear", Meta.GetSys("esercizio")), flag), // null, null, true); //FrmAskFase F = new FrmAskFase(E_S, importo, tUpb, tFinView, Meta.Dispatcher, Meta.Conn); //if (F.ShowDialog() != DialogResult.OK) return; FrmAskInfo fInfo = new FrmAskInfo(Meta, E_S, true) .EnableManagerSelection(true) .AllowNoManagerSelection(true) .EnableFinSelection(true) .EnableUPBSelection(true) .AllowNoUpbSelection(true) .AllowNoFinSelection(true) .AllowNoManagerSelection(true) .EnableFilterAvailable(importo); fInfo.Text = "Impostazione filtro per ricerca movimento"; fInfo.gboxUPB.Text = "Selezionare l'UPB (opzionale)"; fInfo.gboxBilAnnuale.Text = "Selezionare la voce di bilancio (opzionale)"; if (fInfo.ShowDialog() != DialogResult.OK) { return; } int selectedfase = (E_S == "E") ? CfgFn.GetNoNullInt32(Meta.GetSys("maxincomephase")) : CfgFn.GetNoNullInt32(Meta.GetSys("maxexpensephase")); string filter = ""; string filterUpb = QHS.CmpEq("idupb", "0001"); string filterFin = ""; string filterMan = ""; if (selectedfase > 0) { filter = GetData.MergeFilters(filter, QHS.CmpEq("nphase", selectedfase)); } if (fInfo.GetUPB() != DBNull.Value) { filterUpb = QHS.CmpEq("idupb", fInfo.GetUPB()); } if (fInfo.GetFin() != DBNull.Value) { filterFin = QHS.CmpEq("idfin", fInfo.GetFin()); } if (fInfo.GetManager() != DBNull.Value) { filterMan = QHS.CmpEq("idman", fInfo.GetManager()); } filter = GetData.MergeFilters(filter, filterUpb); if (filterFin != "") { filter = GetData.MergeFilters(filter, filterFin); } if (filterMan != "") { filter = GetData.MergeFilters(filter, filterMan); } if (importo > 0) { filter = GetData.MergeFilters(filter, QHS.CmpGe("curramount", importo)); } else { filter = GetData.MergeFilters(filter, QHS.CmpGt("curramount", 0)); } string tName = (E_S == "E") ? "income" : "expense"; MetaData E = Meta.Dispatcher.Get(tName); E.FilterLocked = true; E.DS = DS.Clone(); DataRow Choosen = E.SelectOne("default", filter, tName, null); if (Choosen == null) { return; } string Linkedfield = (E_S == "E") ? "linkedidinc" : "linkedidexp"; string SourceField = (E_S == "E") ? "idinc" : "idexp"; Curr[Linkedfield] = Choosen[SourceField]; string vName = (E_S == "E") ? "incomeview" : "expenseview"; DS.Tables[vName].Clear(); Meta.Conn.RUN_SELECT_INTO_TABLE(DS.Tables[vName], null, QHS.AppAnd(QHS.CmpEq(SourceField, Curr[Linkedfield]), QHS.CmpEq("ayear", Meta.GetSys("esercizio"))), null, true); Meta.FreshForm(false); }
private void btnSpesa_Click(object sender, EventArgs e) { if (Meta.IsEmpty) { return; } Meta.GetFormData(true); DataRow Curr = DS.csa_contracttaxexpense.Rows[0]; string filter = ""; object idregauto = Get_Registry_Auto(); int selectedfase = CfgFn.GetNoNullInt32(cmbFaseSpesa.SelectedValue); if (selectedfase > 0) { filter = QHS.AppAnd(filter, QHS.CmpEq("nphase", selectedfase)); //, //QHS.DoPar(QHS.NullOrEq("idreg", idregauto))); } else { filter = QHS.AppAnd(filter, QHS.CmpNe("nphase", Meta.GetSys("maxexpensephase")), QHS.CmpGe("nphase", Meta.GetSys("expensefinphase"))); //, //QHS.DoPar(QHS.NullOrEq("idreg", idregauto))); } int ymov = CfgFn.GetNoNullInt32(txtEserc.Text.Trim()); int nmov = CfgFn.GetNoNullInt32(txtNum.Text.Trim()); if ((ymov != 0) && (nmov != 0)) { filter = QHS.AppAnd(filter, QHS.CmpEq("ymov", ymov), QHS.CmpEq("nmov", nmov)); } else { var f = new FrmAskInfo(Meta, "S", true); if (f.ShowDialog() != DialogResult.OK) { return; } if (ymov != 0) { filter = QHS.AppAnd(filter, QHS.CmpEq("ymov", ymov)); } if ((nmov != 0)) { filter = QHS.AppAnd(filter, QHS.CmpEq("nmov", nmov)); } var filterUpb = QHC.CmpEq("idupb", "0001"); var filterFin = ""; // 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 = QHS.AppAnd(filter, filterUpb); if (filterFin != "") { filter = QHS.AppAnd(filter, filterFin); } } MetaData E = Meta.Dispatcher.Get("expense"); E.FilterLocked = true; E.DS = DS.Clone(); DataRow Choosen = E.SelectOne("default", filter, "expense", null); if (Choosen == null) { return; } int oldIdExp = CfgFn.GetNoNullInt32(Curr["idexp"]); int newIdExp = CfgFn.GetNoNullInt32(Choosen["idexp"]); Curr["idexp"] = 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); txtEserc.Text = Choosen["ymov"].ToString(); txtNum.Text = Choosen["nmov"].ToString(); cmbFaseSpesa.SelectedValue = Choosen["nphase"]; 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); }
private void btnSpesa_Click(object sender, EventArgs e) { if (_controller.IsEmpty) { return; } _controller.GetFormData(true); var curr = DS.csa_contractexpense.Rows[0]; var filter = ""; var selectedfase = CfgFn.GetNoNullInt32(cmbFaseSpesa.SelectedValue); var idregcsa = Get_Registry_Csa(); if (selectedfase > 0) { filter = QHS.AppAnd(filter, QHS.CmpEq("nphase", selectedfase), QHS.DoPar(QHS.NullOrEq("idreg", idregcsa))); } else { filter = QHS.AppAnd(filter, QHS.CmpNe("nphase", _security.GetSys("maxexpensephase")), QHS.CmpGe("nphase", _security.GetSys("expensefinphase")), QHS.DoPar(QHS.NullOrEq("idreg", idregcsa))); } var ymov = CfgFn.GetNoNullInt32(txtEserc.Text.Trim()); var nmov = CfgFn.GetNoNullInt32(txtNum.Text.Trim()); if ((ymov != 0) && (nmov != 0)) { filter = QHS.AppAnd(filter, QHS.CmpEq("ymov", ymov), QHS.CmpEq("nmov", nmov)); } else { var ff = new FrmAskInfo(_meta as MetaData, "S", true).EnableManagerSelection(false); if (ff.ShowDialog() != DialogResult.OK) { return; } //var f = new FrmAskFase("S", _dispatcher as EntityDispatcher, _conn as DataAccess); //if (f.ShowDialog() != DialogResult.OK) return; if (ymov != 0) { filter = QHS.AppAnd(filter, QHS.CmpEq("ymov", ymov)); } if ((nmov != 0)) { filter = QHS.AppAnd(filter, QHS.CmpEq("nmov", nmov)); } var filterUpb = QHC.CmpEq("idupb", "0001"); var filterFin = ""; // Aggiunta filtro dell'UPB e del Bilancio if (ff.GetUPB() != DBNull.Value) { filterUpb = QHS.CmpEq("idupb", ff.GetUPB()); if (ff.GetFin() != DBNull.Value) { filterFin = QHS.CmpEq("idfin", ff.GetFin()); } } filter = QHS.AppAnd(filter, filterUpb); if (filterFin != "") { filter = QHS.AppAnd(filter, filterFin); } } var expense = _dispatcher.Get("expense"); expense.FilterLocked = true; expense.DS = DS.Clone(); var choosen = expense.SelectOne("default", filter, "expense", null); if (choosen == null) { return; } curr["idexp"] = choosen["idexp"]; DS.expenseview.Clear(); _conn.RUN_SELECT_INTO_TABLE(DS.expenseview, null, QHS.AppAnd(QHS.CmpEq("idexp", curr["idexp"]), QHS.CmpEq("ayear", _security.GetEsercizio())), null, true); txtEserc.Text = choosen["ymov"].ToString(); txtNum.Text = choosen["nmov"].ToString(); cmbFaseSpesa.SelectedValue = choosen["nphase"]; _controller.FreshForm(false, false); }
private void btnSpesa_Click(object sender, EventArgs e) { if (_controller.IsEmpty) { return; } if (_controller.ErroreIrrecuperabile) { return; } _controller.GetFormData(true); var curr = DS.csa_contract_partition.Rows[0]; var filter = ""; var selectedfase = CfgFn.GetNoNullInt32(cmbFaseSpesa.SelectedValue); var idregcsa = Get_Registry_Csa(); if (selectedfase > 0) { filter = QHS.AppAnd(filter, QHS.CmpEq("nphase", selectedfase)); } else { filter = QHS.AppAnd(filter, QHS.CmpNe("nphase", _security.GetSys("maxexpensephase")), QHS.CmpGe("nphase", _security.GetSys("expensefinphase")), QHS.CmpLt("nphase", _security.GetSys("expenseregphase"))); } var ymov = CfgFn.GetNoNullInt32(txtEserc.Text.Trim()); var nmov = CfgFn.GetNoNullInt32(txtNum.Text.Trim()); if ((ymov != 0) && (nmov != 0)) { filter = QHS.AppAnd(filter, QHS.CmpEq("ymov", ymov), QHS.CmpEq("nmov", nmov)); } else { object selectedUPB = curr["idupb"]; object selectedFin = curr["idfin"]; if (ymov != 0) { filter = QHS.AppAnd(filter, QHS.CmpEq("ymov", ymov)); } if ((nmov != 0)) { filter = QHS.AppAnd(filter, QHS.CmpEq("nmov", nmov)); } if (selectedUPB != DBNull.Value) { filter = QHS.AppAnd(filter, QHS.CmpEq("idupb", selectedUPB)); } if (selectedFin != DBNull.Value) { filter = QHS.AppAnd(filter, QHS.CmpEq("idfin", selectedFin)); } } var expense = _dispatcher.Get("expense"); expense.FilterLocked = true; expense.DS = DS.Clone(); var choosen = expense.SelectOne("default", filter, "expense", null); if (choosen == null) { return; } curr["idexp"] = choosen["idexp"]; DS.expenseview.Clear(); _conn.RUN_SELECT_INTO_TABLE(DS.expenseview, null, QHS.AppAnd(QHS.CmpEq("idexp", curr["idexp"]), QHS.CmpEq("ayear", _security.GetEsercizio())), null, true); txtEserc.Text = choosen["ymov"].ToString(); txtNum.Text = choosen["nmov"].ToString(); cmbFaseSpesa.SelectedValue = choosen["nphase"]; curr["idfin"] = choosen["idfin"]; curr["idupb"] = choosen["idupb"]; _conn.RUN_SELECT_INTO_TABLE(DS.fin, null, QHS.CmpEq("idfin", curr["idfin"]), null, true); _conn.RUN_SELECT_INTO_TABLE(DS.upb, null, QHS.CmpEq("idupb", curr["idupb"]), null, true); _controller.FreshForm(false, false); }
private void btnSpesa_Click(object sender, EventArgs e) { if (Meta.IsEmpty) { return; } Meta.GetFormData(true); DataRow Curr = DS.csa_contracttax_partition.Rows[0]; string filter = ""; object idregauto = Get_Registry_Auto(); int selectedfase = CfgFn.GetNoNullInt32(cmbFaseSpesa.SelectedValue); if (selectedfase > 0) { filter = QHS.AppAnd(filter, QHS.CmpEq("nphase", selectedfase)); //, } else { filter = QHS.AppAnd(filter, QHS.CmpNe("nphase", Meta.GetSys("maxexpensephase")), QHS.CmpGe("nphase", Meta.GetSys("expensefinphase")), QHS.CmpLt("nphase", Meta.GetSys("expenseregphase"))); } int ymov = CfgFn.GetNoNullInt32(txtEserc.Text.Trim()); int nmov = CfgFn.GetNoNullInt32(txtNum.Text.Trim()); if ((ymov != 0) && (nmov != 0)) { filter = QHS.AppAnd(filter, QHS.CmpEq("ymov", ymov), QHS.CmpEq("nmov", nmov)); } else { object selectedUPB = Curr["idupb"]; object selectedFin = Curr["idfin"]; if (ymov != 0) { filter = QHS.AppAnd(filter, QHS.CmpEq("ymov", ymov)); } if ((nmov != 0)) { filter = QHS.AppAnd(filter, QHS.CmpEq("nmov", nmov)); } var filterUpb = ""; if (selectedUPB != DBNull.Value) { filterUpb = QHC.CmpEq("idupb", selectedUPB); } var filterFin = ""; if (selectedFin != DBNull.Value) { filterFin = QHC.CmpEq("idfin", selectedFin); } filter = QHS.AppAnd(filter, filterUpb); if (filterFin != "") { filter = QHS.AppAnd(filter, filterFin); } } MetaData E = Meta.Dispatcher.Get("expense"); E.FilterLocked = true; E.DS = DS.Clone(); DataRow Choosen = E.SelectOne("default", filter, "expense", null); if (Choosen == null) { return; } int oldIdExp = CfgFn.GetNoNullInt32(Curr["idexp"]); int newIdExp = CfgFn.GetNoNullInt32(Choosen["idexp"]); Curr["idexp"] = 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); txtEserc.Text = Choosen["ymov"].ToString(); txtNum.Text = Choosen["nmov"].ToString(); cmbFaseSpesa.SelectedValue = Choosen["nphase"]; Curr["idfin"] = Choosen["idfin"]; Curr["idupb"] = Choosen["idupb"]; Meta.Conn.RUN_SELECT_INTO_TABLE(DS.fin, null, QHS.CmpEq("idfin", Curr["idfin"]), null, true); Meta.Conn.RUN_SELECT_INTO_TABLE(DS.upb, null, QHS.CmpEq("idupb", Curr["idupb"]), null, true); Meta.FreshForm(false); }