private bool DoOnF5(ComboBox sender) { Action <string> act = value => { if (value != null) { sender.Text = value; } }; if (sender == cbIINien || sender == cbIINizd) { MyMainForm.ShowFormAcp3Dialog(act); return(true); } if (sender == cbPVNien || sender == cbPVNizd || sender == cbPVNdeb || sender == cbPVNkred) { MyMainForm.ShowFormAcp5Dialog(act); return(true); } return(false); }
private void DoCurrCheck() { var adap = MyData.GetKlonsRepAdapter("ROps1a") as ROps1aTableAdapter; adap.FillBy_curcheck_01(MyData.DataSetKlonsRep.ROps1a, startDate, endDate, ac, null, currency); ReportViewerData rd = new ReportViewerData(); rd.FileName = "Report_DokSar_1"; rd.Sources["DataSet1"] = MyData.DataSetKlonsRep.ROps1a; string paramstr = string.Format( "Dokumenti ar valūtas konvertācijas kļūdām \nDatums:[{0}-{1}], konts: [{2}]", startDateStr, endDateStr, cbAC.Text); rd.AddReportParameters( new string[] { "RSD", startDateStr, "RED", endDateStr, "RACX", "", "RACNM", paramstr, "CompanyName", MyData.Params.CompNameX }); MyMainForm.ShowReport(rd); }
private void DoIt(int repid) { string rt = Check(); if (rt != "OK") { MyMainForm.ShowWarning(rt); return; } SaveParams(); var ad = MyData.GetKlonsRepAdapter("ROps1a") as ROps1aTableAdapter; switch (repid) { case 1: ad.FillBy_pvn_check_02(MyData.DataSetKlonsRep.ROps1a, startDate, endDate, slieksnis, likme); break; case 2: ad.FillBy_pvn_check_01(MyData.DataSetKlonsRep.ROps1a, startDate, endDate, slieksnis, likme); break; default: return; } var f = MyMainForm.ShowForm(typeof(Form_PVN_Piel)); if (f == null) { return; } f.Text = "Dokumenti ar ķļudām"; }
private void DoApgr1() { var ad = MyData.GetKlonsRepAdapter("ROps2a") as ROps2aTableAdapter; if (ad == null) { return; } ad.FillBy_apgr_cur_01_clid(MyData.DataSetKlonsRep.ROps2a, startDate, endDate, ac, null, currency); MyData.ReportHelper.PrepareRops2a(); ReportViewerData rd = new ReportViewerData(); rd.FileName = "Report_Apgr_Bil"; rd.Sources["DataSet1"] = MyData.DataSetKlonsRep.ROps2a; rd.AddReportParameters( new string[] { "RSD", startDateStr, "RED", endDateStr, "RACX", cbAC.Text, "RACNM", lbACName.Text, "CompanyName", MyData.Params.CompNameX, "RCURRENCY", currency }); MyMainForm.ShowReport(rd); }
private void SearchDoc() { if (dgvOPS.CurrentRow == null) { return; } try { var rv = dgvOPS.CurrentRow.DataBoundItem as DataRowView; int id = (int)rv["docid"]; if (MyData.DataSetKlons.OPSd.FindByid(id) == null) { FillDocs(); } var f = MyMainForm.ShowFormDocs(); if (f == null) { return; } f.SearchId(id); } catch (ConstraintException) { return; } }
private void DoIt() { string rt = Check(); if (rt != "OK") { MyMainForm.ShowWarning(rt); return; } try { MyData.CreateNewDB(name, descr); } catch (Exception ex) { Form_Error.ShowException(this, new Exception("Neizdevās izveidot jaunu datubāzi.", ex)); return; } MyData.SaveMasterList(); MyMainForm.ShowInfo ( "Pēc jaunas datubāzes izveidošanas neaizmirstam idarīt sekojošo:\n" + "1. Rediģēt lietotāju sarakstu\n" + "2. Aizpildīt formu 'Ziņas par uzņēmumu'\n" + "3. Formā 'Kā strādādim?' atzīmēt nepieciešamās kontējuma pazīmes\n" + "4. Rediģēt kontu plānu\n" + "5. Aizpildīt formu 'Kontējumu korekcijas'" ); DialogResult = DialogResult.OK; }
void RepSplitPay() { if (!SaveData()) { return; } if (bsRows.Current == null || dgvRows.CurrentRow == null || dgvRows.CurrentRow.IsNewRow) { return; } var dr = bsRows.CurrentDataRow as KlonsADataSet.PAYLISTS_RRow; var ad2 = new KlonsA.DataSets.KlonsARepDataSetTableAdapters.SP_PAY_MATCHLISTS_1XTableAdapter(); var tab2 = ad2.GetDataBy_SP_PAY_MATCHLISTS_12(dr.IDAM, dr.PAY, dr.PAYLISTSRow.DT, dr.IDS); var dr2 = tab2[0]; int idam = dr.IDAM; var dt = dr.PAYLISTSRow.DT; var ci = new PayListCalcInfo(true); var ret = ci.Calc(dr, dr2); if (ret != "OK") { MyMainForm.ShowWarning(ret); return; } Form_PayCalc.Show(ci, Form_PayCalc.EReportType.Splitpay); }
private void DoIt() { string rt = Check(); if (rt != "OK") { MyMainForm.ShowWarning(rt); return; } SaveParams(); DataView rv = new DataView(MyData.DataSetKlons.Persons, "clid = '" + clid + "'", null, DataViewRowState.CurrentRows); ReportViewerData rd = new ReportViewerData(); rd.FileName = "Report_Rekins_1"; rd.Sources["DataSet1"] = MyData.DataSetKlonsRep.TRepOPSd; rd.Sources["DataSet2"] = rv; rd.AddReportParameters( new string[] { "RCOMPNAME", MyData.Params.CompName, "RREGNR", MyData.Params.CompRegNr, "RPVNREGNR", MyData.Params.CompRegNrPVN, "RADRESE", MyData.Params.CompAddr + ", " + MyData.Params.CompAddrInd, "RBANKASKODS", MyData.Params.BankId, "RBANKA", MyData.Params.BankName, "RKONTS", MyData.Params.BankAcc, "RDESCR", tbDescr.Text, "RSIGNER", tbSigner.Text }); MyMainForm.ShowReport(rd); }
public void DoEditUsers() { try { if (!CheckUser()) { return; } string tp = MyData.GetUserGroup(tbUser.Text); if (string.IsNullOrEmpty(tp)) { return; } if (tp == "A") { MyMainForm.ShowFormUsersDialog(); } else if (tp == "B") { Form_UserPSW f1 = new Form_UserPSW(); f1.SelectedValue = tbPSW.Text; if (f1.ShowDialog(this) == DialogResult.OK) { MyData.ChangeUserPassword(tbUser.Text, f1.SelectedValue); } } } catch (Exception ex) { MyException e1 = new MyException("Neizdevās pieslēgt datubāzi.", ex); Form_Error.ShowException(this, e1); return; } }
private void dgvAmati_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { if (e.RowIndex == dgvAmati.NewRowIndex) { return; } if (e.ColumnIndex == dgcAmatiUsed.Index) { bool val = (bool)e.FormattedValue; if (val) { return; } var dr = dgvAmati.GetDataRow(e.RowIndex) as KlonsADataSet.POSITIONSRow; if (dr == null) { return; } if (IsLastUsedRow(dr)) { MyMainForm.ShowWarning("Jābūt vismaz vienam aktīvam amatam."); e.Cancel = true; return; } } }
private void cmReport_Click(object sender, EventArgs e) { if (bsRows.DataSource == null || bsRows.Count == 0) { MyMainForm.ShowInfo("Pārskatam nav datu."); return; } MyData.ReportHelper.CheckForErrors(() => { if (DoGrouping) { if (GroupFieldsOrderA[1] == -1) { MakeReport2(); } else if (GroupFieldsOrderA[3] == -1) { MakeReport3(); } else { MyMainForm.ShowWarning("Atlasītajiem datiem programma atskaiti nevar izveidot."); } } else { MakeReport1(); } }); }
private void DoIt() { string rt = Check(); if (rt != "OK") { MyMainForm.ShowWarning(rt); return; } ROps2aTableAdapter ad = MyData.GetKlonsRepAdapter("ROps2a") as ROps2aTableAdapter; if (ad == null) { return; } ad.FillBy_pvn_10(MyData.DataSetKlonsRep.ROps2a, startDate, endDate); SaveParams(); ReportViewerData rd = new ReportViewerData(); rd.FileName = "Report_PVN_kops"; rd.Sources["DataSet1"] = MyData.DataSetKlonsRep.ROps2a; rd.AddReportParameters( new string[] { "RSD", MyData.Params.RSD, "RED", MyData.Params.RED, "CompanyName", MyData.Params.CompName }); MyMainForm.ShowReport(rd); }
private void cmOK_Click(object sender, EventArgs e) { SaveMyData(); MyMainForm.CheckMyFontAndColors(); MyMainForm.CheckMenuColorTheme(); this.Close(); }
private void DoIt() { if (lbCM.SelectedIndex == -1) { return; } string er = "OK"; if (lbCM.SelectedIndex == 0) { MakeAll = true; MakeEmpty = false; er = Check(false); } else if (lbCM.SelectedIndex == 1) { MakeAll = false; MakeEmpty = false; er = Check(true); } else if (lbCM.SelectedIndex == 2) { MakeAll = false; MakeEmpty = true; er = Check(false); } if (er != "OK") { MyMainForm.ShowWarning(er); return; } DialogResult = DialogResult.OK; }
private bool AskCanDeleteA() { if (bsUsers.Current == null || bsUsers.Count == 1) { return(false); } if ((bsUsers.Current as DataRowView).Row["tp"].ToString() == "A") { if (CountAdmins() == 1) { MyMainForm.ShowWarning("Nedrīkst izdzēst pēdējo administratoru."); return(false); } } if (!MyData.Params.AskBeforeDelete) { return(true); } DialogResult response = MyMessageBox.Show("Vai dzēst lietotāju?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MyMainForm); return(response == DialogResult.Yes); }
private void DoIt() { string rt = Check(); if (rt != "OK") { MyMainForm.ShowWarning(rt); return; } try { MyData.CreateNewDB(name, descr); } catch (Exception ex) { Form_Error.ShowException(this, new Exception("Neizdevās izveidot jaunu datubāzi.", ex)); return; } MyData.SaveMasterList(); MyMainForm.ShowInfo ( "Pēc jaunas datubāzes izveidošanas neaizmirstam idarīt sekojošo:\n" + "1. Aizpildīt formu 'Ziņas par uzņēmumu'\n" + "2. Formā 'Kā strādādim?' norādīt darba parametrus" ); DialogResult = DialogResult.OK; }
private bool CheckUser() { if (MyData.Settings.MasterEntry.Name == "") { MyMainForm.ShowWarning("Jāizvēlas pieslēdzamā datubāze!"); return(false); } if (tbUser.Text == "") { MyMainForm.ShowWarning("Jāievada lietotāja vārds!", ""); return(false); } if (MyData.CurrentDBTag == null || !MyData.CurrentDBTag.Equals(MyData.Settings.MasterEntry)) { if (!ConnectTo(MyData.Settings.MasterEntry, tbUser.Text, null)) { return(false); } MyData.SetUpTableManagerForUsersTable(); } if (!MyData.TestUserPassword(tbUser.Text, tbPSW.Text)) { MyMainForm.ShowWarning("Nepareizs lietotāja vārds vai parole"); return(false); } return(true); }
private void DoRename() { if (!SaveData()) { return; } var dr = dgvBalA1.GetCurrentDataRow() as klonsDataSet.BalA1Row; if (dr == null) { return; } Form_InputBox f = new Form_InputBox("Bilances atskaites", "Mainīt atskaites kodu", dr.balid); if (f.ShowDialog(MyMainForm) != DialogResult.OK) { return; } string newid = f.SelectedValue; if (newid == dr.balid) { return; } if (newid == "" || newid.Length > 10 || MyData.DataSetKlons.BalA1.FindBybalid(newid) != null) { MyMainForm.ShowWarning("Nekorekts atskaites kods: " + newid); return; } dr.balid = newid; bsBalA2.GetTable().AcceptChanges(); dgvBalA1.RefreshCurrent(); SaveData(); }
private void SearchText(bool fromfirst = true, bool forward = true) { if (dgvDocs0.CurrentRow == null || dgvDocs0.CurrentRow.IsNewRow) { return; } if (!dgvDocs0.EndEditX()) { return; } int startindex = dgvDocs0.CurrentRow.Index; startindex = fromfirst ? 0 : (forward ? startindex + 1 : startindex - 1); string text = tsbSearch.Text; if (text == "") { return; } int newindex = SearchText(text, dgvDocs0.CurrentCell.ColumnIndex, startindex, forward); if (newindex == -1) { MyMainForm.ShowInfo("Tekts [" + text + "] netika atrasts."); return; } dgvDocs0.CurrentCell = dgvDocs0[dgvDocs0.CurrentCell.ColumnIndex, newindex]; }
private void DoIt() { string rt = Check(); if (rt != "OK") { MyMainForm.ShowWarning(rt); return; } int selectedreport = lbCM.SelectedIndex; if (selectedreport == -1) { return; } SaveParams(); if (selectedreport == 4) { DoIt3(); return; } if (selectedreport == 0 || selectedreport == 1) { DoIt1(selectedreport); return; } if (selectedreport == 2 || selectedreport == 3) { DoIt2(selectedreport); return; } }
private void dgvSar_RowValidating(object sender, DataGridViewCellCancelEventArgs e) { if (!Filtered || e.RowIndex == -1 || e.RowIndex == dgvSar.NewRowIndex) { return; } var dt = (DateTime)dgvSar[dgcDT.Index, e.RowIndex].Value; if (dt < FilterDt1 || dt > FilterDt2) { MyMainForm.ShowWarning("Datums ārpus filtra."); e.Cancel = true; return; } if (FilterIDA != int.MinValue) { var ida = (int)dgvSar[dgcIDA.Index, e.RowIndex].Value; if (ida != FilterIDA) { MyMainForm.ShowWarning("Darbinieks, amats nesakrīt ar filtrā norādīto."); e.Cancel = true; return; } } }
public void MakeReport3() { //var cnm = new[] { "Kat.", "Nol.kat.", "Nod.nol. kat.", "Strv.", "Atrodas" }; var cnm = new[] { "Kategorija", "Nolietojuma kategorija", "Nolietojuma kategorija nodokļa aprēķinam", "Struktīr-vienība", "Atrošanās vieta" }; var cnm2 = new string[5]; for (int i = 0; i < 5; i++) { cnm2[i] = GroupFieldsOrderA[i] == -1 ? "" : cnm[GroupFieldsOrderA[i]]; } ReportViewerData rd = new ReportViewerData(); rd.FileName = "ReportP_Kustiba_3"; rd.Sources["DataSet1"] = ReportMovement.ReportRows; rd.AddReportParameters( new string[] { "PCompany", MyData.Params.CompNameX, "PDate1", Utils.DateToString(DT1), "PDate2", Utils.DateToString(DT2), "PFilterStr", "Atlases parametri:" + MakeFilterStr(), "PCNM1", cnm2[0], "PCNM2", cnm2[1], "PCNM3", cnm2[2], "PCNM4", cnm2[3] }); MyMainForm.ShowReport(rd); }
private void DoCurrDiff() { var ad = MyData.GetKlonsRepAdapter("ROps2a") as ROps2aTableAdapter; if (ad == null) { return; } ad.FillBy_currdiff_01(MyData.DataSetKlonsRep.ROps2a, startDate, endDate, ac, null, currency); if (MyData.DataSetKlonsRep.ROps2a.Count == 0) { MyMainForm.ShowWarning("Ar dotajiem parametriem dati netika atrasti"); return; } var dr = MyData.DataSetKlonsRep.ROps2a[0]; decimal d1, d2, d3, d4; d1 = dr.ADb - dr.ACr; d2 = dr.BDb - dr.BCr; string s = ac.Substring(0, 1); if (s != "1" && s != "2") { d1 = -d1; d2 = -d2; } d3 = Math.Round(d1 * currrate, 2); d4 = d3 - d2; dr.ADb = d1; dr.ACr = d3; dr.TDb = d2; dr.TCr = d4; MyData.DataSetKlonsRep.ROps2a.AcceptChanges(); ReportViewerData rd = new ReportViewerData(); rd.FileName = "Report_CurrDiff"; rd.Sources["DataSet1"] = MyData.DataSetKlonsRep.ROps2a; s = string.Format( "Valūta: {0}\nKonts: {1} {2}\nPersona: {3} {4}", currency, cbAC.Text, lbACName.Text, cbClid.Text, lbClName.Text); rd.AddReportParameters( new string[] { "RSD", startDateStr, "RED", endDateStr, "RACX", cbAC.Text, "RACNM", s, "CompanyName", MyData.Params.CompNameX, "RCURRENCY", currency }); MyMainForm.ShowReport(rd); }
private void bniXMLImport_Click(object sender, EventArgs e) { if (!SaveData()) { return; } var form = MyMainForm.ShowFormDialog(typeof(Form_UntaxedMinimumImport)) as Form_UntaxedMinimumImport; }
public void DoAddPosition() { if (!SaveData()) { return; } var fp = MyMainForm.FindForm(typeof(Form_Persons)); if (fp != null) { MyMainForm.ShowWarning("Darbinieku saraksta forma ir atvērta."); return; } if (bsPersons.Count == 0 || bsPersons.Current == null) { return; } var drp = (bsPersons.Current as DataRowView)?.Row as KlonsADataSet.PERSONSRow; if (drp == null) { return; } var fpn = new Form_PersonNewPos(); fpn.PersonName = drp.FNAME + " " + drp.LNAME; var rt = fpn.ShowDialog(MyMainForm); if (rt != DialogResult.OK) { return; } var tableAmati = MyData.DataSetKlons.POSITIONS; var tableAmatiR = MyData.DataSetKlons.POSITIONS_R; var dr_am = tableAmati.NewPOSITIONSRow(); dr_am.IDP = drp.ID; dr_am.PERSONSRow = drp; dr_am.TITLE = fpn.PositionTitle; dr_am.IDDEP = fpn.iddep; tableAmati.AddPOSITIONSRow(dr_am); var dr_amr = tableAmatiR.NewPOSITIONS_RRow(); dr_amr.IDA = dr_am.ID; dr_amr.POSITIONSRow = dr_am; dr_amr.EDIT_DATE = DateTime.Today; dr_amr.TITLE = dr_am.TITLE; dr_amr.IDDEP = dr_am.IDDEP; tableAmatiR.AddPOSITIONS_RRow(dr_amr); SelectPosition(dr_am.ID); SaveData(); }
public bool CanDelete() { if (MyMainForm.FindForm(typeof(Form_Plan)) != null) { MyMainForm.ShowWarning("Vispirms jāaizver forma [Darba laika kopplāns]."); return(false);; } return(true); }
public bool CanDelete() { if (MyMainForm.FindForm(typeof(Form_TimeSheet)) != null) { MyMainForm.ShowWarning("Vispirms jāaizver froma [Darba laika uzskaites lapa]."); return(false);; } return(true); }
private void DoIt1(int selectedreport) { var ad = MyData.GetKlonsAdapter("BalA21") as BalA21TableAdapter; var ad2 = MyData.GetKlonsAdapter("BalA22") as BalA22TableAdapter; if (ad == null) { return; } try { MyData.DataSetKlons.BalA21.Clear(); MyData.DataSetKlons.BalA22.Clear(); ad2.Fill(MyData.DataSetKlons.BalA22); ad.FillBy_bal_12(MyData.DataSetKlons.BalA21, startDate, endDate, balid); } catch (Exception) { MyMainForm.ShowWarning("Neizdevās sagatavot atskaiti."); return; } MyData.ReportHelper.FillBalA2FromBalA21(balid); ReportViewerData rd = new ReportViewerData(); switch (selectedreport) { case 0: rd.FileName = "Report_Bilance_2"; break; case 1: rd.FileName = "Report_Bilance_1"; break; } DataView dv = new DataView( MyData.DataSetKlons.BalA22, "balid = '" + balid + "'", "dc, nr", DataViewRowState.CurrentRows); rd.Sources["DataSet1"] = dv; rd.AddReportParameters( new string[] { "RSD", MyData.Params.RSD, "RED", MyData.Params.RED, "CompanyName", MyData.Params.CompNameX, "RTITLE", rtitle, "RAKTIVS", raktivs, "RPASIVS", rpasivs }); MyMainForm.ShowReport(rd); }
public bool IsSheetFormClosed() { if (MyMainForm.FindForm(typeof(Form_SalarySheet)) != null) { MyMainForm.ShowWarning("Vispirms jāaizver forma [Algas aprēķina lapa]."); return(false);; } return(true); }
private void cmFilter_Click(object sender, EventArgs e) { var er = DoFilter(); if (er != "OK") { MyMainForm.ShowWarning(er); } }