private void button1_Click(object sender, EventArgs e) { ///////////////// LogMe //////////////////////// String function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name; String usedQC = "Add to list"; String data = ""; String Result = ""; LogWriter lw = new LogWriter(); //////////////////////////////////////////////// /// try { ListViewItem lvi1 = new ListViewItem(); rb = listView1.Items.Count + 1; lvi1.Text = rb.ToString(); //if ((sifrarnikArr.IndexOf((long.Parse((textBox1.Text).Substring(4)).ToString()))) < 0) //DecoderBB if ((sifrarnikArr.IndexOf(Decoder.GetFullPartCodeStr(textBox1.Text))) < 0) { data = textBox1.Text; Result = "Selected code does not exist in DB."; lw.LogMe(function, usedQC, data, Result); MessageBox.Show(Result); textBox1.SelectAll(); return; } addToList(true, long.Parse(textBox1.Text), textBox2.Text, textBox3.Text); //lvi1.SubItems.Add(sifrarnikArr[sifrarnikArr.IndexOf((long.Parse((textBox1.Text).Substring(4)).ToString())) - 1]); //DecoderBB if (data.Equals("")) { data = textBox1.Text + ", " + textBox2.Text + ", " + textBox3.Text + ", ng"; } else { data = data + Environment.NewLine + " " + textBox1.Text + ", " + textBox2.Text + ", " + textBox3.Text + ", ng"; } } catch (Exception e1) { new LogWriter(e1); MessageBox.Show(e1.Message); } }
private void ISSSelectorCb_SelectedIndexChanged(object sender, EventArgs e) { if (oneTimeISSSelectorCb) { if (obj != null) { obj = null; oneTimeISSSelectorCb = false; } ///////////////// LogMe //////////////////////// String function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name; String usedQC = "ISS loaded"; String data = ""; String Result = ""; LogWriter lw = new LogWriter(); //////////////////////////////////////////////// /// try { CleanMe(); listView2.Clear(); listView2.View = View.Details; listView2.Columns.Add("RB"); listView2.Columns.Add("Name"); listView2.Columns.Add("CodeO"); listView2.Columns.Add("SNO"); listView2.Columns.Add("CNO"); listView2.Columns.Add("CodeN"); listView2.Columns.Add("SNN"); listView2.Columns.Add("CNN"); listView2.Columns.Add("Date"); listView2.Columns.Add("Time"); listView2.Columns.Add("Work done"); listView2.Columns.Add("Comment"); long issID = long.Parse(ISSSelectorCb.SelectedItem.ToString()); Part mainPr = new Part(); //List<String> allISSInfo = new List<String>(); getISSList(issID.ToString(), "ID"); ISSid = issID; allISSInfo = qc.GetAllISSInfoById(issID); if (allISSInfo[0].Equals("nok")) { return; } totalTime = allISSInfo[6] + ":00"; mainPart = qc.SearchPartsInAllTablesBYPartID(long.Parse(allISSInfo[4]))[0]; PartTb.Text = mainPart.CodePartFull.ToString(); cmpCust.GetCompanyInfoByCode(Decoder.GetCustomerCode(mainPart.CodePartFull)); listIssParts.Clear(); listIssParts = qc.GetAllISSPartsByISSid(issID); NameTb.Text = Decoder.ConnectCodeName(sifrarnikArr, mainPart); SNTb.Text = mainPart.SN; CNTb.Text = mainPart.CN; DateInTb.Text = mainPart.DateIn; DateSentTb.Text = mainPart.DateSend; IDTb.Text = mainPart.PartID.ToString(); for (int i = 0; i < listIssParts.Count; i++) { ListViewItem lvi1 = new ListViewItem(listIssParts[i].RB.ToString().ToString()); lvi1.SubItems.Add(qc.PartInfoByFullCodeSifrarnik(mainPart.PartialCode).FullName); ////////////////////////////////////////////////////////////// if (listIssParts[i].PrtO.CodePartFull == 0) { lvi1.SubItems.Add(""); } else { lvi1.SubItems.Add(listIssParts[i].PrtO.CodePartFull.ToString()); } if (listIssParts[i].PrtO.SN == null) { lvi1.SubItems.Add(""); } else { lvi1.SubItems.Add(listIssParts[i].PrtO.SN.ToString()); } if (listIssParts[i].PrtO.CN == null) { lvi1.SubItems.Add(""); } else { lvi1.SubItems.Add(listIssParts[i].PrtO.CN.ToString()); } ////////////////////////////////////////////////////////////// if (listIssParts[i].PrtN.CodePartFull == 0) { lvi1.SubItems.Add(""); } else { lvi1.SubItems.Add(listIssParts[i].PrtN.CodePartFull.ToString()); } if (listIssParts[i].PrtN.SN == null) { lvi1.SubItems.Add(""); } else { lvi1.SubItems.Add(listIssParts[i].PrtN.SN.ToString()); } if (listIssParts[i].PrtN.CN == null) { lvi1.SubItems.Add(""); } else { lvi1.SubItems.Add(listIssParts[i].PrtN.CN.ToString()); } ////////////////////////////////////////////////////////////// lvi1.SubItems.Add(allISSInfo[1]); lvi1.SubItems.Add(listIssParts[i].Time.ToString()); lvi1.SubItems.Add(listIssParts[i].Work.ToString()); lvi1.SubItems.Add(listIssParts[i].Comment.ToString()); if (listView2.Items.Count > 1) { listView2.EnsureVisible(listView2.Items.Count - 1); } listView2.Items.Add(lvi1); } for (int i = 0; i < 12; i++) { listView2.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.ColumnContent); listView2.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.HeaderSize); } rb = listView2.Items.Count + 1; data = cmpCust.Name + ", " + cmpM.Name + ", " + "Sifrarnik arr cnt " + sifrarnikArr.Count + ", " + mainPart.CodePartFull + ", " + "listIssParts cnt " + listIssParts.Count + ", " + ISSid.ToString() + ", " + Properties.strings.ServiceReport + ", " + Properties.strings.customer + ", false"; Result = "ISS selected " + ISSid; lw.LogMe(function, usedQC, data, Result); SystemSounds.Hand.Play(); } catch (Exception e1) { data = ISSid + Environment.NewLine; Result = e1.Message; lw.LogMe(function, usedQC, data, Result); MessageBox.Show(Result, "NOT SAVED", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { oneTimeISSSelectorCb = true; } }
private void button2_Click(object sender, EventArgs e) { ///////////////// LogMe //////////////////////// String function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name; String usedQC = "Save to db"; String data = ""; String Result = ""; LogWriter lw = new LogWriter(); //////////////////////////////////////////////// /// IUSNumber = ""; if (this.label2.Text.Equals("Name")) { Result = "Please select company, nothing done."; lw.LogMe(function, usedQC, data, Result); MessageBox.Show(Result); textBox1.SelectAll(); isFocused = true; textBox1.Focus(); isFocused = false; } else if (this.listView1.Items.Count == 0) { Result = "There is no items in list, nothing done."; lw.LogMe(function, usedQC, data, Result); MessageBox.Show(Result); textBox1.SelectAll(); isFocused = true; textBox1.Focus(); isFocused = false; } else { //List<Part> listOfOtpPartsPrimka = new List<Part>(); MainCmp mpc = new MainCmp(); mpc.GetMainCmpByName(Properties.Settings.Default.CmpName); cmpR.Clear(); cmpR = mpc.MainCmpToCompany(); if (cmpS.GetCompanyByName(label2.Text.Trim())) { try { List <String> arr = new List <string>(); ConnectionHelper cn = new ConnectionHelper(); using (SqlConnection cnnIUS = cn.Connect(WorkingUser.Username, WorkingUser.Password)) { if (cn.TestConnection(cnnIUS)) { //Provjera da li se dijelovi nalaze u mom skladistu QueryCommands qc = new QueryCommands(); for (int i = 0; i < listView1.Items.Count; i++) // vec imam provjeru gore kod unosa ali neka ostane(tamo je po imenu) { if (qc.GetPartIDCompareCodeSNCNStorageState(WorkingUser.Username, WorkingUser.Password, long.Parse(listView1.Items[i].SubItems[2].Text), listView1.Items[i].SubItems[3].Text, listView1.Items[i].SubItems[4].Text, WorkingUser.RegionID, "ng")[0].Equals("nok")) { data = listView1.Items[i].SubItems[2].Text + "\n on position " + (listView1.Items[i].Index + 1); Result = "In your storage does not exist NG part with: \n\n Code: " + listView1.Items[i].SubItems[2].Text + "\n on position " + (listView1.Items[i].Index + 1) + "\n\nNothing Done."; lw.LogMe(function, usedQC, data, Result); MessageBox.Show(Result); textBox1.SelectAll(); isFocused = true; textBox1.Focus(); isFocused = false; return; } } //Provjera i spremanje u bazu List <String> allRegions = new List <string>(); allRegions = qc.GetAllRegions(); int index = resultArrC.FindIndex(resultArrC => resultArrC.Name.Equals(label2.Text)); List <Part> partList = new List <Part>(); String napomenaIUS = textBox4.Text; for (int i = 0; i < listView1.Items.Count; i++) { PartSifrarnik tempSifPart = new PartSifrarnik(); Part tempPart = new Part(); foreach (Part part in partsArr) { tempSifPart.GetPart(Decoder.GetFullPartCodeStr(listView1.Items[i].SubItems[2].Text)); if (part.PartialCode == tempSifPart.FullCode && part.SN.ToUpper().Equals(listView1.Items[i].SubItems[3].Text.ToUpper()) && part.CN.ToUpper().Equals(listView1.Items[i].SubItems[4].Text.ToUpper()) && !partList.Contains(part)) { tempPart = part; tempPart.StorageID = WorkingUser.RegionID; tempPart.State = "sng"; tempPart.CompanyO = Decoder.GetOwnerCode(listView1.Items[i].SubItems[2].Text); tempPart.CompanyC = Decoder.GetCustomerCode(listView1.Items[i].SubItems[2].Text); break; } } String tmpResult = qc.GetListPartsByPartIDFromParts(tempPart.PartID)[0]; if (tmpResult.Equals("nok")) { data = listView1.Items[i].SubItems[2].Text + "\n on position " + (listView1.Items[i].Index + 1); Result = "There is no NG part in your storage with: \n\n Code: " + listView1.Items[i].SubItems[2].Text + "\n on position " + (listView1.Items[i].Index + 1) + ". \n\nNothing Done."; lw.LogMe(function, usedQC, data, Result); MessageBox.Show(Result); textBox1.SelectAll(); isFocused = true; textBox1.Focus(); isFocused = false; return; } else { tempPart.PartID = long.Parse(tmpResult); partList.Add(tempPart); } } IUSNumber = qc.IUSPrebaciUServis(WorkingUser.Username, WorkingUser.Password, partList, WorkingUser.RegionID, cmpS.ID, napomenaIUS); if (!IUSNumber.Equals("nok")) { partsArr = partsArr.Except(partList).ToList(); PovijestLog pl = new PovijestLog(); if (Program.SaveDocumentsPDF) { saveToPDF(partList); } if (pl.SaveToPovijestLog(partList, DateTime.Now.ToString("dd.MM.yy."), napomenaIUS, cmpS.Name, "", "", "IUS " + Properties.Settings.Default.ShareDocumentName, "sng")) { Properties.Settings.Default.ShareDocumentName = ""; Result = "DONE, document nbr. IUS '" + IUSNumber + "'."; lw.LogMe(function, usedQC, data, Result); MessageBox.Show(Result); partListPrint.Clear(); partListPrint.AddRange(partList); isIUSSaved = true; listView1.Clear(); listView1.View = View.Details; listView1.Columns.Add("RB"); listView1.Columns.Add("Name"); listView1.Columns.Add("Code"); listView1.Columns.Add("SN"); listView1.Columns.Add("CN"); listView1.Columns.Add("Condition"); textBox4.Clear(); napomenaIUSPrint = napomenaIUS; } else { Result = "DONE, document nbr. 'IUS " + IUSNumber + "', but not saved in PL."; lw.LogMe(function, usedQC, data, Result); MessageBox.Show(Result); partListPrint.Clear(); partListPrint.AddRange(partList); isIUSSaved = true; listView1.Clear(); listView1.View = View.Details; listView1.Columns.Add("RB"); listView1.Columns.Add("Name"); listView1.Columns.Add("Code"); listView1.Columns.Add("SN"); listView1.Columns.Add("CN"); listView1.Columns.Add("Condition"); textBox4.Clear(); napomenaIUSPrint = napomenaIUS; } } else { Result = "Unknown error in QUERY."; lw.LogMe(function, usedQC, data, Result); MessageBox.Show(Result); napomenaIUSPrint = ""; isIUSSaved = false; } //} } cnnIUS.Close(); } } catch (Exception e1) { new LogWriter(e1); MessageBox.Show(e1.Message); textBox1.SelectAll(); isFocused = true; textBox1.Focus(); isFocused = false; } } this.printPrewBT.Enabled = isIUSSaved; } }
private void addToList(Boolean clear, long mCode, String mSN, String mCN) { ///////////////// LogMe //////////////////////// String function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name; String usedQC = "Add to list"; String data = ""; String Result = ""; LogWriter lw = new LogWriter(); //////////////////////////////////////////////// /// try { ListViewItem lvi1 = new ListViewItem(); rb = listView1.Items.Count + 1; lvi1.Text = rb.ToString(); //if ((sifrarnikArr.IndexOf((long.Parse((textBox1.Text).Substring(4)).ToString()))) < 0) //DecoderBB if ((sifrarnikArr.IndexOf(Decoder.GetFullPartCodeStr(mCode.ToString()))) < 0) { data = mCode.ToString(); Result = "Selected code does not exist in DB."; lw.LogMe(function, usedQC, data, Result); MessageBox.Show(Result); textBox1.SelectAll(); return; } //lvi1.SubItems.Add(sifrarnikArr[sifrarnikArr.IndexOf((long.Parse((textBox1.Text).Substring(4)).ToString())) - 1]); //DecoderBB lvi1.SubItems.Add(sifrarnikArr[sifrarnikArr.IndexOf(Decoder.GetFullPartCodeStr(mCode.ToString())) - 1]); lvi1.SubItems.Add(mCode.ToString()); lvi1.SubItems.Add(mSN); lvi1.SubItems.Add(mCN); lvi1.SubItems.Add("ng"); if (listView1.Items.Count > 1) { listView1.EnsureVisible(listView1.Items.Count - 1); } listView1.Items.Add(lvi1); if (data.Equals("")) { data = mCode.ToString() + ", " + mSN + ", " + mCN + ", g"; } else { data = data + Environment.NewLine + " " + mCode.ToString() + ", " + mSN + ", " + mCN + ", g"; } } catch (Exception e1) { new LogWriter(e1); MessageBox.Show(e1.Message); } for (int i = 0; i < listView1.Columns.Count; i++) { listView1.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.ColumnContent); listView1.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.HeaderSize); } if (clear) { textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); } textBox1.SelectAll(); isFocused = true; textBox1.Focus(); isFocused = false; Result = "Added"; lw.LogMe(function, usedQC, data, Result); SystemSounds.Hand.Play(); }
private void listView1_DoubleClick(object sender, EventArgs e) { ///////////////// LogMe //////////////////////// String function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name; String usedQC = "PRIM Selected"; String data = ""; String Result = ""; LogWriter lw = new LogWriter(); //////////////////////////////////////////////// /// this.label7.Text = "Working..."; this.Refresh(); br.Clear(); if (!pictureOn) { Thread myThread = new Thread(fillSifrarnik); myThread.Start(); } listView2.Items.Clear(); listView2.Refresh(); this.label5.Text = ""; List <long> prtList = new List <long>(); List <Part> parts = new List <Part>(); long primID; int rb; Part prt = new Part(); var item = listView1.SelectedItems; if (item.Count == 0) { this.label7.Text = ""; return; } int index = item[0].Index; long threadCmpCode = long.Parse(item[0].SubItems[2].Text); Thread myThreadCmp = new Thread(() => fillCmp(threadCmpCode)); myThreadCmp.Start(); primID = long.Parse(item[0].SubItems[1].Text); prtList = qc.GetAllpartIDByPrimID(primID); this.label5.Text = "Selected PRIM: " + primID.ToString(); datumIzradeM = userArr[(5 * index) + 2]; izradioUserM = userArr[(5 * index) + 4]; QueryCommands qc4 = new QueryCommands(); List <String> test = qc4.User(WorkingUser.Username, WorkingUser.Password, izradioUserM); if (!test[0].Equals("nok")) { izradioRegijaM = test[7]; } else { MessageBox.Show("I cant find user. Provjeri sto ne radi dobro na primci od germanie"); return; } if (prtList[0] == -1) { data = primID.ToString(); Result = "Can not find parts by given primID."; lw.LogMe(function, usedQC, data, Result); MessageBox.Show(Result); return; } try { rb = listView2.Items.Count + 1; parts = prt.GetListOfPartsFromPartsPartsPoslanoByID(prtList); if (parts.Count == 0) { data = primID.ToString(); Result = "Selected PRIM (" + primID.ToString() + ") does not exist or do not have parts."; lw.LogMe(function, usedQC, data, Result); MessageBox.Show(Result); return; } var groupedPartsListSN = parts.GroupBy(c => c.CodePartFull).Select(grp => grp.ToList()).ToList(); int i = 0; for (int k = 0; k < groupedPartsListSN.Count; k++) { String name = (sifrarnikArr[sifrarnikArr.IndexOf(Decoder.GetFullPartCodeStr(parts[i].PartialCode.ToString())) - 1]); for (i = 0; i < groupedPartsListSN[k].Count; i++) { ListViewItem lvi2 = new ListViewItem(rb.ToString()); lvi2.SubItems.Add(name); lvi2.SubItems.Add(groupedPartsListSN[k][i].CodePartFull.ToString()); lvi2.SubItems.Add(groupedPartsListSN[k][i].SN); lvi2.SubItems.Add(groupedPartsListSN[k][i].CN); if (listView2.Items.Count > 1) { listView2.EnsureVisible(listView2.Items.Count - 1); } listView2.Items.Add(lvi2); rb = listView2.Items.Count + 1; if (data.Equals("")) { data = groupedPartsListSN[k][i].CodePartFull.ToString() + ", " + groupedPartsListSN[k][i].SN + ", " + groupedPartsListSN[k][i].CN; } else { data = data + Environment.NewLine + " " + groupedPartsListSN[k][i].CodePartFull.ToString() + ", " + groupedPartsListSN[k][i].SN + ", " + groupedPartsListSN[k][i].CN; } } } } catch (Exception e1) { new LogWriter(e1); MessageBox.Show(e1.Message); } for (int i = 0; i < listView2.Columns.Count; i++) { listView2.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.ColumnContent); listView2.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.HeaderSize); } PRIMNumber = string.Format("{0:00/000}", primID); partListPrint.AddRange(parts); napomenaPRIMPrint = item[0].SubItems[4].Text; ////////////////// TODO ODKOMENTIRAJ AKO BUDES NA PRIMCI IMAO ISPIS FILIJALE/////////////////// //if (!item[0].SubItems[6].Text.Equals("")) // br.GetFilByID(long.Parse(item[0].SubItems[7].Text)); br.FilID = 0; if (!cmpR.Name.Equals("")) { this.label8.Text = "cmpR: OK"; } else { this.label8.Text = "cmpR: NOK"; } if (!cmpS.Name.Equals("")) { this.label9.Text = "cmpS: OK"; } else { this.label9.Text = "cmpS: NOK"; } if (br.FilID != 0) { this.label10.Text = "br: OK"; } else { this.label10.Text = "br: NOK"; } Result = "Added"; lw.LogMe(function, usedQC, data, Result); SystemSounds.Hand.Play(); this.label7.ResetText(); }
private void PartsList_Load(object sender, EventArgs e) { fillSifrarnik(); this.Text = "PartList"; listView1.View = View.Details; listView1.Columns.Add("PardID"); listView1.Columns.Add("Name"); listView1.Columns.Add("CodePartFull"); listView1.Columns.Add("PartialCode"); listView1.Columns.Add("SN"); listView1.Columns.Add("CN"); listView1.Columns.Add("DateIn"); listView1.Columns.Add("DateOut"); listView1.Columns.Add("DateSent"); listView1.Columns.Add("Storage"); listView1.Columns.Add("State"); listView1.Columns.Add("CompanyO"); listView1.Columns.Add("CompanyC"); try { int i = 0; if (!resultArr[0].Equals("nok")) { for (i = 0; i < resultArr.Count(); i = i + 12) { ListViewItem lvi1 = new ListViewItem(); lvi1.Text = resultArr[i]; lvi1.SubItems.Add(resultArr[i + 1]); lvi1.SubItems.Add(Decoder.ConnectCodeName(sifrarnikArr, long.Parse(resultArr[i + 1]))); lvi1.SubItems.Add(resultArr[i + 2]); lvi1.SubItems.Add(resultArr[i + 3]); lvi1.SubItems.Add(resultArr[i + 4]); lvi1.SubItems.Add(resultArr[i + 5]); lvi1.SubItems.Add(resultArr[i + 6]); lvi1.SubItems.Add(resultArr[i + 7]); lvi1.SubItems.Add(resultArr[i + 8]); lvi1.SubItems.Add(resultArr[i + 9]); lvi1.SubItems.Add(resultArr[i + 10]); lvi1.SubItems.Add(resultArr[i + 11]); listView1.Items.Add(lvi1); } } this.label2.Text = (i / 12).ToString(); } catch (Exception e1) { Program.LoadStop(); this.Focus(); new LogWriter(e1); MessageBox.Show(e1.Message); } for (int i = 0; i < 13; i++) { listView1.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.ColumnContent); listView1.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.HeaderSize); } Program.LoadStop(); this.Focus(); }
private void addToList(Boolean remove, Boolean update, OfferParts invPrt) { ///////////////// LogMe //////////////////////// String function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name; String usedQC = "Add to list"; String data = ""; String Result = ""; LogWriter lw = new LogWriter(); //////////////////////////////////////////////// /// decimal cijena = 0; decimal popust = 0; decimal partTotal = 0; decimal partsTotal = 0; //decimal cijena = decimal.Parse(CheckIfKNZero(tempSifPart)); if (!remove) { decimal kn = tempSifPart.PriceOutKn; decimal eur = tempSifPart.PriceOutEur; if (radioButtonENG.Checked) { cijena = eur > 0 ? eur : kn / (decimal)ech; } else { cijena = kn > 0 ? kn : eur * (decimal)ech; } popust = invPrt.Rabat; partTotal = invPrt.PartTotalPrice(cijena, popust, invPrt.VrijemeRada); partsTotal = partTotal * invPrt.Kolicina; //TOTAL += partsTotal; TOTALTAXBASE += partsTotal; TOTALTAX = TOTALTAXBASE * vat; TOTAL = TOTALTAX + TOTALTAXBASE; offer.Iznos = TOTAL; } else { cijena = decimal.Parse(invPrt.IznosTotal); //TOTAL += partsTotal; TOTALTAXBASE -= cijena; TOTALTAX = TOTALTAXBASE * vat; TOTAL = TOTALTAX + TOTALTAXBASE; offer.Iznos = TOTAL; } try { String dd; if (!remove && !update) { ListViewItem lvi1 = new ListViewItem(); rb = listView1.Items.Count + 1; lvi1.Text = rb.ToString(); lvi1.SubItems.Add(tempSifPart.FullName); lvi1.SubItems.Add(mainCmp.Code.ToString() + customerCmp.Code.ToString() + Decoder.GetFullPartCodeStr(tempSifPart.FullCode)); lvi1.SubItems.Add(String.Format("{0:0.00}", cijena)); lvi1.SubItems.Add(invPrt.VrijemeRada); lvi1.SubItems.Add(String.Format("{0:0.00}", invPrt.Rabat)); lvi1.SubItems.Add(String.Format("{0:#0}", invPrt.Kolicina)); lvi1.SubItems.Add(String.Format("{0:0.00}", partTotal)); lvi1.SubItems.Add(String.Format("{0:0.00}", partsTotal)); if (listView1.Items.Count > 1) { listView1.EnsureVisible(listView1.Items.Count - 1); } listView1.Items.Add(lvi1); dd = tempSifPart.FullName + ", " + Decoder.GetFullPartCodeStr(tempSifPart.FullCode.ToString()) + ", " + tempSifPart.PriceInKn.ToString() + ", " + invPrt.VrijemeRada + ", " + invPrt.Rabat.ToString() + ", " + invPrt.Kolicina.ToString() + ", " + partTotal + ", " + partsTotal + ", " + TOTAL.ToString(); invPrt.IznosPart = String.Format("{0:N2}", cijena); invPrt.IznosRabat = String.Format("{0:N2}", partTotal); invPrt.IznosTotal = String.Format("{0:N2}", partsTotal); if (data.Equals("")) { data = dd; } else { data = data + Environment.NewLine + " " + dd; } } else { dd = tempSifPart.FullName + ", " + Decoder.GetFullPartCodeStr(tempSifPart.FullCode.ToString()) + ", " + tempSifPart.PriceInKn.ToString() + ", " + invPrt.VrijemeRada + ", " + invPrt.Rabat.ToString() + ", " + invPrt.Kolicina.ToString() + ", " + partTotal + ", " + partsTotal + ", " + TOTAL.ToString(); if (data.Equals("")) { data = dd; } else { data = data + Environment.NewLine + " " + dd; } } if (radioButtonENG.Checked) { TaxBaseLB.Text = String.Format("{0:0.00}", TOTALTAXBASE * (decimal)ech); VATLB.Text = String.Format("{0:0.00}", TOTALTAX * (decimal)ech); TotalEURLB.Text = String.Format("{0:0.00}", TOTAL); TotalKNLB.Text = String.Format("{0:0.00}", (TOTAL * (decimal)ech)); } else { TaxBaseLB.Text = String.Format("{0:0.00}", TOTALTAXBASE); VATLB.Text = String.Format("{0:0.00}", TOTALTAX); TotalEURLB.Text = String.Format("{0:0.00}", TOTAL / (decimal)ech); TotalKNLB.Text = String.Format("{0:0.00}", TOTAL); } } catch (Exception e1) { new LogWriter(e1); MessageBox.Show(e1.Message); } for (int i = 0; i < listView1.Columns.Count; i++) { listView1.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.ColumnContent); listView1.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.HeaderSize); } //if (clear) //{ // textBox1.Clear(); // textBox2.Clear(); // textBox3.Clear(); //} //textBox1.SelectAll(); //isFocused = true; //textBox1.Focus(); //isFocused = false; Result = "Added"; lw.LogMe(function, usedQC, data, Result); SystemSounds.Hand.Play(); }