void ReplaceStrings() { ContractDTO contract = MainForm.DB.Contracts.Get(MainForm.DB.Invoices.Get((lBDeliveryNotes.SelectedItem as DeliveryNoteDTO).InvoiceId).ContractId); InvoiceDTO invoice = MainForm.DB.Invoices.Get((lBDeliveryNotes.SelectedItem as DeliveryNoteDTO).InvoiceId); WordWorker.FindReplace("{dateNakl}", dTPData.Value.ToShortDateString()); WordWorker.FindReplace("{contractName}", contract.ToString()); WordWorker.FindReplace("{invoiceName}", invoice.ToString()); WordWorker.FindReplace("{numberNakl}", tBNumber.Text.ToString()); WordWorker.FindReplace("{nameCompanySeller}", MainForm.DB.Sellers.Get(contract.SellerId).NameCompany); WordWorker.FindReplace("{nameCompanyCustomer}", MainForm.DB.Customers.Get(contract.CustomerId).NameCompany); WordWorker.FindReplace("{fullNameCompanySeller}", MainForm.DB.Sellers.Get(contract.SellerId).FullNameCompany); WordWorker.FindReplace("{fullNameCompanyCustomer}", MainForm.DB.Customers.Get(contract.CustomerId).FullNameCompany); WordWorker.FindReplace("{nameSeller}", MainForm.DB.Sellers.Get(contract.SellerId).NameSeller); WordWorker.FindReplace("{addressCustomer}", MainForm.DB.Customers.Get(contract.CustomerId).AddressCompany); WordWorker.FindReplace("{addressSeller}", MainForm.DB.Sellers.Get(contract.SellerId).AddressCompany); WordWorker.FindReplace("{innCustomer}", MainForm.DB.Customers.Get(contract.CustomerId).INN.ToString()); WordWorker.FindReplace("{innSeller}", MainForm.DB.Sellers.Get(contract.SellerId).INN.ToString()); WordWorker.FindReplace("{kppCustomer}", MainForm.DB.Customers.Get(contract.CustomerId).KPP.ToString()); WordWorker.FindReplace("{kppSeller}", MainForm.DB.Sellers.Get(contract.SellerId).KPP.ToString()); WordWorker.FindReplace("{personalAccountCustomer}", MainForm.DB.Customers.Get(contract.CustomerId).PersonalAccount); WordWorker.FindReplace("{corespAccountSeller}", MainForm.DB.Sellers.Get(contract.SellerId).CorrespondentAccount); WordWorker.FindReplace("{bikCustomer}", MainForm.DB.Customers.Get(contract.CustomerId).BIK.ToString()); WordWorker.FindReplace("{bikSeller}", MainForm.DB.Sellers.Get(contract.SellerId).BIK.ToString()); WordWorker.FindReplace("{bikCustomer}", MainForm.DB.Customers.Get(contract.CustomerId).BIK.ToString()); WordWorker.FindReplace("{bankCustomer}", MainForm.DB.Customers.Get(contract.CustomerId).Bank); WordWorker.FindReplace("{bankSeller}", MainForm.DB.Sellers.Get(contract.SellerId).Bank); WordWorker.FindReplace("{bankAccountCustomer}", MainForm.DB.Customers.Get(contract.CustomerId).BankAccount); WordWorker.FindReplace("{bankAccountSeller}", MainForm.DB.Sellers.Get(contract.SellerId).BankAccount); WordWorker.FindReplace("{priemName}", tBPriemName.Text); WordWorker.FindReplace("{gruzName}", tBGruzName.Text); string replacedOfWord = WordWorker.ReplaceOfWord(float.Parse(lSumm.Text)); if (lSumm.Text.Contains(',')) { if (lSumm.Text.Substring(lSumm.Text.IndexOf(',')).Length - 1 == 2) { WordWorker.FindReplace("{total}", replacedOfWord.Remove(replacedOfWord.Length - 1)); WordWorker.FindReplace("{kopeiki}", lSumm.Text.Substring(lSumm.Text.IndexOf(',') + 1)); } else { WordWorker.FindReplace("{total}", replacedOfWord.Remove(replacedOfWord.Length - 1)); WordWorker.FindReplace("{kopeiki}", lSumm.Text.Substring(lSumm.Text.IndexOf(',') + 1) + "0"); } } else { WordWorker.FindReplace("{total}", replacedOfWord.Remove(replacedOfWord.Length - 1)); WordWorker.FindReplace("{kopeiki}", "00"); } }
void ReplaceStrings() { WordWorker.FindReplace("{date}", dTPData.Value.ToShortDateString()); WordWorker.FindReplace("{contractDate}", (cBContracts.SelectedItem as ContractDTO).ConclusionDate.ToLongDateString()); WordWorker.FindReplace("{contractNumber}", (cBContracts.SelectedItem as ContractDTO).Number.ToString()); WordWorker.FindReplace("{number}", tBNumber.Text.ToString()); WordWorker.FindReplace("{NameCompanySeller}", MainForm.DB.Sellers.Get((cBContracts.SelectedItem as ContractDTO).SellerId).NameCompany); WordWorker.FindReplace("{nameCompanyCustomer}", MainForm.DB.Customers.Get((cBContracts.SelectedItem as ContractDTO).CustomerId).NameCompany); WordWorker.FindReplace("{nameSeller}", MainForm.DB.Sellers.Get((cBContracts.SelectedItem as ContractDTO).SellerId).NameSeller); WordWorker.FindReplace("{addressCustomer}", MainForm.DB.Customers.Get((cBContracts.SelectedItem as ContractDTO).CustomerId).AddressCompany); WordWorker.FindReplace("{addressSeller}", MainForm.DB.Sellers.Get((cBContracts.SelectedItem as ContractDTO).SellerId).AddressCompany); WordWorker.FindReplace("{innCustomer}", MainForm.DB.Customers.Get((cBContracts.SelectedItem as ContractDTO).CustomerId).INN.ToString()); WordWorker.FindReplace("{innSeller}", MainForm.DB.Sellers.Get((cBContracts.SelectedItem as ContractDTO).SellerId).INN.ToString()); WordWorker.FindReplace("{kppCustomer}", MainForm.DB.Customers.Get((cBContracts.SelectedItem as ContractDTO).CustomerId).KPP.ToString()); WordWorker.FindReplace("{kppSeller}", MainForm.DB.Sellers.Get((cBContracts.SelectedItem as ContractDTO).SellerId).KPP.ToString()); string replacedOfWord = WordWorker.ReplaceOfWord(Math.Round(float.Parse(lSumm.Text), 2)); if (lSumm.Text.Contains(',')) { if (lSumm.Text.Substring(lSumm.Text.IndexOf(',')).Length - 1 == 2) { WordWorker.FindReplace("{total}", replacedOfWord.Remove(replacedOfWord.Length - 1)); WordWorker.FindReplace("{kopeiki}", lSumm.Text.Substring(lSumm.Text.IndexOf(',') + 1)); } else { WordWorker.FindReplace("{total}", replacedOfWord.Remove(replacedOfWord.Length - 1)); WordWorker.FindReplace("{kopeiki}", lSumm.Text.Substring(lSumm.Text.IndexOf(',') + 1) + "0"); } } else { WordWorker.FindReplace("{total}", replacedOfWord.Remove(replacedOfWord.Length - 1)); WordWorker.FindReplace("{kopeiki}", "00"); } }
void ReplaceStrings() { WordWorker.FindReplace("{date}", dTPData.Value.ToShortDateString()); WordWorker.FindReplace("{dateEnd}", dTPOkonch.Value.ToShortDateString()); WordWorker.FindReplace("{typeSpec}", cBTypeProducts.Text); WordWorker.FindReplace("{number}", tBNumber.Text.ToString()); WordWorker.FindReplace("{address}", "п.Советский"); WordWorker.FindReplace("{fullNameCompanyCustomer}", (cBCustomer.SelectedItem as CustomerDTO).FullNameCompany); WordWorker.FindReplace("{fullNameCompanySeller}", (cBSeller.SelectedItem as SellerDTO).FullNameCompany); WordWorker.FindReplace("{nameCustomerSpec}", (cBCustomer.SelectedItem as CustomerDTO).NameCustomerSpec); WordWorker.FindReplace("{nameCustomer}", (cBCustomer.SelectedItem as CustomerDTO).NameCustomer); WordWorker.FindReplace("{nameSeller}", (cBSeller.SelectedItem as SellerDTO).NameSeller); WordWorker.FindReplace("{nameSellerSpec}", (cBSeller.SelectedItem as SellerDTO).NameSellerSpec); WordWorker.FindReplace("{addressCustomer}", (cBCustomer.SelectedItem as CustomerDTO).AddressCompany); WordWorker.FindReplace("{addressSeller}", "Адрес: " + (cBSeller.SelectedItem as SellerDTO).AddressCompany); if (!(cBSeller.SelectedItem as SellerDTO).Email.Equals("")) { WordWorker.FindReplace("{emailSeller}", "Email:" + (cBSeller.SelectedItem as SellerDTO).Email); } else { WordWorker.FindReplace("{emailSeller}", "" + (cBSeller.SelectedItem as SellerDTO).Email); } WordWorker.FindReplace("{personalAccountCustomer}", (cBCustomer.SelectedItem as CustomerDTO).PersonalAccount); if (!(cBSeller.SelectedItem as SellerDTO).PersonalAccount.Equals("")) { WordWorker.FindReplace("{corespAccountSeller}", "к/с: " + (cBSeller.SelectedItem as SellerDTO).CorrespondentAccount); } else { WordWorker.FindReplace("{corespAccountSeller}", "" + (cBSeller.SelectedItem as SellerDTO).CorrespondentAccount); } WordWorker.FindReplace("{bikCustomer}", (cBCustomer.SelectedItem as CustomerDTO).BIK.ToString()); if (!(cBSeller.SelectedItem as SellerDTO).BIK.Equals("")) { WordWorker.FindReplace("{bikSeller}", "БИК: " + (cBSeller.SelectedItem as SellerDTO).BIK.ToString()); } else { WordWorker.FindReplace("{bikSeller}", "" + (cBSeller.SelectedItem as SellerDTO).BIK.ToString()); } if (!(cBSeller.SelectedItem as SellerDTO).OGRN.Equals("")) { WordWorker.FindReplace("{ogrnSeller}", "ОГРН: " + (cBSeller.SelectedItem as SellerDTO).OGRN.ToString()); } else { WordWorker.FindReplace("{ogrnSeller}", "" + (cBSeller.SelectedItem as SellerDTO).OGRN.ToString()); } WordWorker.FindReplace("{bikCustomer}", (cBCustomer.SelectedItem as CustomerDTO).BIK.ToString()); WordWorker.FindReplace("{innCustomer}", (cBCustomer.SelectedItem as CustomerDTO).INN.ToString()); if (!(cBSeller.SelectedItem as SellerDTO).INN.Equals("")) { WordWorker.FindReplace("{innSeller}", "ИНН: " + (cBSeller.SelectedItem as SellerDTO).INN.ToString()); } else { WordWorker.FindReplace("{innSeller}", "" + (cBSeller.SelectedItem as SellerDTO).INN.ToString()); } WordWorker.FindReplace("{kppCustomer}", (cBCustomer.SelectedItem as CustomerDTO).KPP.ToString()); if (!(cBSeller.SelectedItem as SellerDTO).KPP.Equals("")) { WordWorker.FindReplace("{kppSeller}", "КПП: " + (cBSeller.SelectedItem as SellerDTO).KPP.ToString()); } else { WordWorker.FindReplace("{kppSeller}", "" + (cBSeller.SelectedItem as SellerDTO).KPP.ToString()); } WordWorker.FindReplace("{bankCustomer}", (cBCustomer.SelectedItem as CustomerDTO).Bank); if (!(cBSeller.SelectedItem as SellerDTO).Bank.Equals("")) { WordWorker.FindReplace("{bankSeller}", "Банк: " + (cBSeller.SelectedItem as SellerDTO).Bank); } else { WordWorker.FindReplace("{bankSeller}", "" + (cBSeller.SelectedItem as SellerDTO).Bank); } WordWorker.FindReplace("{bankAccountCustomer}", (cBCustomer.SelectedItem as CustomerDTO).BankAccount); if (!(cBSeller.SelectedItem as SellerDTO).BankAccount.Equals("")) { WordWorker.FindReplace("{bankAccountSeller}", "р/с: " + (cBSeller.SelectedItem as SellerDTO).BankAccount); } else { WordWorker.FindReplace("{bankAccountSeller}", "" + (cBSeller.SelectedItem as SellerDTO).BankAccount); } if (!(cBSeller.SelectedItem as SellerDTO).PhoneNumber.Equals("")) { WordWorker.FindReplace("{phoneSeller}", "Телефон: " + (cBSeller.SelectedItem as SellerDTO).PhoneNumber); } else { WordWorker.FindReplace("{phoneSeller}", "" + (cBSeller.SelectedItem as SellerDTO).PhoneNumber); } WordWorker.FindReplace("{rangSeller}", (cBSeller.SelectedItem as SellerDTO).RangSeller); WordWorker.FindReplace("{nameResponssable}", tBOtv.Text.ToString()); WordWorker.FindReplace("{year}", dTPData.Value.Year.ToString()); WordWorker.FindReplace("{total}", Math.Round(float.Parse(lSumm.Text)).ToString()); string replacedOfWord = WordWorker.ReplaceOfWord(float.Parse(lSumm.Text)); if (lSumm.Text.Contains(',')) { if (lSumm.Text.Substring(lSumm.Text.IndexOf(',')).Length - 1 == 2) { WordWorker.FindReplace("{totalRub}", replacedOfWord.Remove(replacedOfWord.Length - 1)); WordWorker.FindReplace("{kopeiki}", lSumm.Text.Substring(lSumm.Text.IndexOf(',') + 1)); } else { WordWorker.FindReplace("{totalRub}", replacedOfWord.Remove(replacedOfWord.Length - 1)); WordWorker.FindReplace("{kopeiki}", lSumm.Text.Substring(lSumm.Text.IndexOf(',') + 1) + "0"); } } else { WordWorker.FindReplace("{totalRub}", replacedOfWord.Remove(replacedOfWord.Length - 1)); WordWorker.FindReplace("{kopeiki}", "00"); } }