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 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 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; }
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 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 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; } } }
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 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 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 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; }
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); }
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 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 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); }
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(); }
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 CanDelete() { if (MyMainForm.FindForm(typeof(Form_TimeSheet)) != null) { MyMainForm.ShowWarning("Vispirms jāaizver froma [Darba laika uzskaites lapa]."); return(false);; } return(true); }
public bool IsSheetFormClosed() { if (MyMainForm.FindForm(typeof(Form_SalarySheet)) != null) { MyMainForm.ShowWarning("Vispirms jāaizver forma [Algas aprēķina lapa]."); return(false);; } return(true); }
public bool CanDelete() { if (MyMainForm.FindForm(typeof(Form_Plan)) != null) { MyMainForm.ShowWarning("Vispirms jāaizver forma [Darba laika kopplāns]."); return(false);; } return(true); }
private void cmFilter_Click(object sender, EventArgs e) { var er = DoFilter(); if (er != "OK") { MyMainForm.ShowWarning(er); } }
private void cmAddEvent_Click(object sender, EventArgs e) { if (!StateOK) { MyMainForm.ShowWarning("Vispirms jāveic aprēķins."); return; } DialogResult = DialogResult.OK; }
public void MakeListFromTempl(int yr, int mt, int idsh = int.MinValue) { var ret = DataTasks.MakeTimeSheetsFromTempl(yr, mt, idsh); if (ret != "OK") { MyMainForm.ShowWarning(ret); return; } }
private void cmCalc_Click(object sender, EventArgs e) { var rt = DoCalc(); if (rt != "OK") { MyMainForm.ShowWarning(rt); return; } }
private bool CheckParams() { var rt = CheckParamsA(); if (rt != "OK") { MyMainForm.ShowWarning(rt); return(false); } return(true); }
private void cmGetData_Click(object sender, EventArgs e) { var er = CheckParams(); if (er != "OK") { MyMainForm.ShowWarning(er); return; } FilterData(); }
private void DoIt(int k) { string rt = Check(); if (rt != "OK") { MyMainForm.ShowWarning(rt); return; } SaveParams(); var ad = MyData.GetKlonsRepAdapter("ROps1a") as ROps1aTableAdapter; if (k == 1) { ad.FillBy_skaidra_01(MyData.DataSetKlonsRep.ROps1a, startDate, endDate, limit1, "JP"); } else { ad.FillBy_skaidra_02(MyData.DataSetKlonsRep.ROps1a, startDate, endDate, limit2, "FP"); } ReportViewerData rd = new ReportViewerData(); rd.FileName = "Report_Skaidra_1"; rd.Sources["DataSet1"] = MyData.DataSetKlonsRep.ROps1a; string s1 = "", s = " "; int i = 13; if (k == 2) { i = startDate.Month; } s1 = s.Substring(0, i - 1); s1 += "X"; s1 += s.Substring(0, 13 - i); rd.AddReportParameters( new string[] { "PYEAR", startDate.Year.ToString(), "PMONTH", s1, "Company", MyData.Params.CompName, "Addr", MyData.Params.CompAddr, "AddrInd", MyData.Params.CompAddrInd, "RegNr", MyData.Params.CompRegNr, "Manager", MyData.Params.CompMName, "Phone", MyData.Params.CompPhone }); MyMainForm.ShowReport(rd); }
private void DoIt2(int selectedreport) { var ad = MyData.GetKlonsAdapter("BalA2") as BalA2TableAdapter; var ad2 = MyData.GetKlonsRepAdapter("SP_REP_BAL_22") as SP_REP_BAL_22TableAdapter; if (ad == null) { return; } try { MyData.DataSetKlons.BalA2.Clear(); MyData.DataSetKlons.BalA22.Clear(); MyData.DataSetKlonsRep.SP_REP_BAL_22.Clear(); ad.Fill(MyData.DataSetKlons.BalA2); ad2.Fill(MyData.DataSetKlonsRep.SP_REP_BAL_22, startDate, endDate, balid); } catch (Exception) { MyMainForm.ShowWarning("Neizdevās sagatavot atskaiti."); return; } List <RepRow_BalMT> reprows = null; ReportViewerData rd = new ReportViewerData(); switch (selectedreport) { case 2: reprows = PrepareReportMt_apgr(balid, MyData.DataSetKlonsRep.SP_REP_BAL_22); rd.FileName = "Report_Bilance_31"; break; case 3: reprows = PrepareReportMt_atl(balid, MyData.DataSetKlonsRep.SP_REP_BAL_22); rd.FileName = "Report_Bilance_41"; break; } rd.Sources["DataSet1"] = reprows; 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); }
private void dgvPrevMonths_RowValidating(object sender, DataGridViewCellCancelEventArgs e) { object mt = dgvPrevMonths[dgcMT.Index, e.RowIndex]?.Value; if (mt == null || (int)mt < 1 || (int)mt > 12) { MyMainForm.ShowWarning("Nekorekts mēnesis."); e.Cancel = true; return; } }
private void cmOK_Click(object sender, EventArgs e) { var er = Check(); if (er != "OK") { MyMainForm.ShowWarning(er); return; } DialogResult = DialogResult.OK; }