void RefreshBalancesView() { dgFund.ItemsSource = balancesQuery; txt_count.Text = balancesQuery.Count().ToString(); decimal total = balancesQuery.Select(b => b.balance.Value).Sum(); tb_total.Text = SectionData.DecTostring(total); }
private async Task fillPosInfo() { await MainWindow.refreshBalance(); //cashes = await cashModel.GetCashTransfer("d", "p"); cashes = await cashModel.GetCashTransferForPosById("all", "p", (int)MainWindow.posID); cashesQuery = cashes.Where(s => s.isConfirm == 1 && s.posId == MainWindow.posID.Value && s.isConfirm2 == 0).ToList(); if (cashesQuery.Count() == 0) { txt_balanceState.Text = MainWindow.resourcemanager.GetString("trAvailable"); btn_save.IsEnabled = true; } else { txt_balanceState.Text = MainWindow.resourcemanager.GetString("trWaiting"); btn_save.IsEnabled = false; } if (MainWindow.posLogIn.balance != 0) { txt_cashValue.Text = SectionData.DecTostring(MainWindow.posLogIn.balance); } else { txt_cashValue.Text = "0"; } status = MainWindow.posLogIn.boxState; if (MainWindow.posLogIn.boxState == "c") { txt_balanceState.Text = MainWindow.resourcemanager.GetString("trUnavailable"); txt_stateValue.Text = MainWindow.resourcemanager.GetString("trClosed"); txt_stateValue.Foreground = Application.Current.Resources["MainColorRed"] as SolidColorBrush;; tgl_isClose.IsChecked = false; btn_save.IsEnabled = false; cb_pos.IsEnabled = false; } else { txt_stateValue.Text = MainWindow.resourcemanager.GetString("trOpen"); txt_stateValue.Foreground = Application.Current.Resources["mediumGreen"] as SolidColorBrush;; tgl_isClose.IsChecked = true; cb_pos.IsEnabled = true; } }
private void fillPieChart() { List <string> titles = new List <string>(); IEnumerable <int> x = null; IEnumerable <decimal> cashes = null; titles.Clear(); var cashTemp = closingTemp.GroupBy(m => m.posId).Select( g => new { posId = g.Key, branchName = g.FirstOrDefault().branchName, branchId = g.FirstOrDefault().branchId, cash = g.LastOrDefault().cash }); titles.AddRange(cashTemp.Select(jj => jj.branchName)); var result = cashTemp.GroupBy(m => m.branchId) .Select( g => new { branchId = g.Key, cash = g.Sum(s => s.cash), }); cashes = result.Select(m => decimal.Parse(SectionData.DecTostring(m.cash.Value))); SeriesCollection piechartData = new SeriesCollection(); for (int i = 0; i < cashes.Count(); i++) { List <decimal> final = new List <decimal>(); List <string> lable = new List <string>(); final.Add(cashes.ToList().Skip(i).FirstOrDefault()); piechartData.Add( new PieSeries { Values = final.AsChartValues(), Title = titles.Skip(i).FirstOrDefault(), DataLabels = true, } ); } chart1.Series = piechartData; }
private void RefreshTaxView() { dgTax.ItemsSource = taxTemp; txt_count.Text = taxTemp.Count().ToString(); decimal total = 0; if (selectedTab == 0) { total = taxTemp.Select(b => b.invTaxVal.Value).Sum(); } else { total = taxTemp.Select(b => b.itemUnitTaxwithQTY.Value).Sum(); } tb_total.Text = SectionData.DecTostring(total); }
void RefreshProfitsView() { dgFund.ItemsSource = profitsQuery; txt_count.Text = profitsQuery.Count().ToString(); decimal total = 0; if (selectedTab == 0) { total = profitsQuery.Select(b => b.invoiceProfit).Sum(); } else { total = profitsQuery.Select(b => b.itemunitProfit).Sum(); } tb_total.Text = SectionData.DecTostring(total); }
private void fillEvents() { temp = statisticModel.getstate(fillList(statement, cb_vendors, cb_vendorsDate), selectedTab, statement); dgPayments.ItemsSource = temp; txt_count.Text = temp.Count().ToString(); decimal cashTotal = temp.Select(x => x.cashTotal).LastOrDefault(); //bool worthy = false; //if (cashTotal >= 0) worthy = true; //if(selectedItem.Equals(MainWindow.resourcemanager.GetString("trCashCustomer"))) // worthy = true; if (cashTotal >= 0) //if (worthy) { txt_total.Text = SectionData.DecTostring(cashTotal); txt_for.Text = MainWindow.resourcemanager.GetString("trWorthy"); repTrRequires = "trWorthy"; tb_moneyIcon.Text = MainWindow.Currency; bdr_email.Visibility = Visibility.Collapsed; } else { cashTotal = -cashTotal; txt_total.Text = cashTotal.ToString(); txt_for.Text = MainWindow.resourcemanager.GetString("trRequired"); repTrRequires = "trRequired"; tb_moneyIcon.Text = MainWindow.Currency; //if (cb_vendors.SelectedItem != null) //{ bdr_email.Visibility = Visibility.Visible; //} //else //{ //bdr_email.Visibility = Visibility.Collapsed; //} } fillRowChart(); fillColumnChart(); fillPieChart(); }
private void Btn_unSelectedInvoice_Click(object sender, RoutedEventArgs e) {//unselect one try { if (sender != null) { SectionData.StartAwait(grid_invoices); } invoice = lst_selectedInvoices.SelectedItem as Invoice; if (invoice != null) { selectedInvoices.Remove(invoice); allInvoices.Add(invoice); lst_allInvoices.ItemsSource = allInvoices; lst_selectedInvoices.ItemsSource = selectedInvoices; lst_allInvoices.Items.Refresh(); lst_selectedInvoices.Items.Refresh(); decimal x = invoice.deserved.Value; sum -= x; tb_sum.Text = " " + SectionData.DecTostring(sum) + " "; } if (sender != null) { SectionData.EndAwait(grid_invoices); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_invoices); } SectionData.ExceptionMessage(ex, this); } }
private void fillPieChart() { List <string> titles = new List <string>(); IEnumerable <int> x = null; IEnumerable <decimal> balances = null; titles.Clear(); //var temp = balancesQuery; var titleTemp = balancesQuery.GroupBy(m => m.branchName); titles.AddRange(titleTemp.Select(jj => jj.Key)); var result = balancesQuery.GroupBy(s => s.branchId) .Select( g => new { branchId = g.Key, balance = g.Sum(s => s.balance), count = g.Count() }); balances = result.Select(m => decimal.Parse(SectionData.DecTostring(m.balance.Value))); SeriesCollection piechartData = new SeriesCollection(); for (int i = 0; i < balances.Count(); i++) { List <decimal> final = new List <decimal>(); List <string> lable = new List <string>(); final.Add(balances.ToList().Skip(i).FirstOrDefault()); piechartData.Add( new PieSeries { Values = final.AsChartValues(), Title = titles.Skip(i).FirstOrDefault(), DataLabels = true, } ); } chart1.Series = piechartData; }
public EmailClass fillSaleTempData(Invoice invoice, List <ItemTransfer> invoiceItems, List <PayedInvclass> mailpayedList, SysEmails email, Agent toAgent, List <SetValues> setvlist) { string invheader = ""; string invfooter = ""; string invbody = ""; string invitemtable = ""; string invitemrow = ""; string paytable = ""; string payrow = ""; string taxdiv = ""; string deliverydiv = ""; //payrow.tmp // paytable.tmp EmailClass mailtosend = new EmailClass(); ReportCls reportclass = new ReportCls(); mailtosend.from = email.email; mailtosend.smtpclient = email.smtpClient; mailtosend.port = (int)email.port; mailtosend.password = Encoding.UTF8.GetString(Convert.FromBase64String(email.password)); mailtosend.isSSl = (bool)email.isSSL; mailtosend.AddTolist(toAgent.email); string cashTr = ""; string sumP = ""; string deservedcash = ""; // data ReportCls repm = new ReportCls(); List <MailimageClass> imgs = new List <MailimageClass>(); MailimageClass img = new MailimageClass(); decimal disval = repm.calcpercentval(invoice.discountType, invoice.discountValue, invoice.total); decimal manualdisval = repm.calcpercentval(invoice.manualDiscountType, invoice.manualDiscountValue, invoice.total); invoice.discountValue = disval + manualdisval; invoice.discountType = "1"; bool isArabic = ReportCls.checkLang(); if (isArabic) { invheader = repm.ReadFile(@"EmailTemplates\ordertemplate\ar\invheader.tmp"); invfooter = repm.ReadFile(@"EmailTemplates\ordertemplate\ar\invfooter.tmp"); deliverydiv = repm.ReadFile(@"EmailTemplates\saletemplate\ar\deliverydiv.tmp"); if (invoice.invType == "s" || invoice.invType == "pw" || invoice.invType == "p") { invbody = repm.ReadFile(@"EmailTemplates\saletemplate\ar\invbody.tmp"); invitemtable = repm.ReadFile(@"EmailTemplates\saletemplate\ar\invitemtable.tmp"); invitemrow = repm.ReadFile(@"EmailTemplates\saletemplate\ar\invitemrow.tmp"); paytable = repm.ReadFile(@"EmailTemplates\saletemplate\ar\paytable.tmp"); payrow = repm.ReadFile(@"EmailTemplates\saletemplate\ar\payrow.tmp"); taxdiv = repm.ReadFile(@"EmailTemplates\saletemplate\ar\taxdiv.tmp"); } else if (invoice.invType == "or" || invoice.invType == "ors") { invbody = repm.ReadFile(@"EmailTemplates\saleordertemplate\ar\invbody.tmp"); invitemtable = repm.ReadFile(@"EmailTemplates\saleordertemplate\ar\invitemtable.tmp"); invitemrow = repm.ReadFile(@"EmailTemplates\saleordertemplate\ar\invitemrow.tmp"); } else if (invoice.invType == "q" || invoice.invType == "qs") { invbody = repm.ReadFile(@"EmailTemplates\quotationtemplate\ar\invbody.tmp"); invitemtable = repm.ReadFile(@"EmailTemplates\quotationtemplate\ar\invitemtable.tmp"); invitemrow = repm.ReadFile(@"EmailTemplates\quotationtemplate\ar\invitemrow.tmp"); } } else { // en invheader = repm.ReadFile(@"EmailTemplates\ordertemplate\en\invheader.tmp"); invfooter = repm.ReadFile(@"EmailTemplates\ordertemplate\en\invfooter.tmp"); deliverydiv = repm.ReadFile(@"EmailTemplates\saletemplate\en\deliverydiv.tmp"); if (invoice.invType == "s" || invoice.invType == "pw" || invoice.invType == "p") { invbody = repm.ReadFile(@"EmailTemplates\saletemplate\en\invbody.tmp"); invitemtable = repm.ReadFile(@"EmailTemplates\saletemplate\en\invitemtable.tmp"); invitemrow = repm.ReadFile(@"EmailTemplates\saletemplate\en\invitemrow.tmp"); paytable = repm.ReadFile(@"EmailTemplates\saletemplate\en\paytable.tmp"); payrow = repm.ReadFile(@"EmailTemplates\saletemplate\en\payrow.tmp"); taxdiv = repm.ReadFile(@"EmailTemplates\saletemplate\en\taxdiv.tmp"); } else if (invoice.invType == "or" || invoice.invType == "ors") { invbody = repm.ReadFile(@"EmailTemplates\saleordertemplate\en\invbody.tmp"); invitemtable = repm.ReadFile(@"EmailTemplates\saleordertemplate\en\invitemtable.tmp"); invitemrow = repm.ReadFile(@"EmailTemplates\saleordertemplate\en\invitemrow.tmp"); } else if (invoice.invType == "q" || invoice.invType == "qs") { invbody = repm.ReadFile(@"EmailTemplates\quotationtemplate\en\invbody.tmp"); invitemtable = repm.ReadFile(@"EmailTemplates\quotationtemplate\en\invitemtable.tmp"); invitemrow = repm.ReadFile(@"EmailTemplates\quotationtemplate\en\invitemrow.tmp"); } else { invbody = repm.ReadFile(@"EmailTemplates\saletemplate\en\invbody.tmp"); invitemtable = repm.ReadFile(@"EmailTemplates\saletemplate\en\invitemtable.tmp"); invitemrow = repm.ReadFile(@"EmailTemplates\saletemplate\en\invitemrow.tmp"); paytable = repm.ReadFile(@"EmailTemplates\saletemplate\en\paytable.tmp"); payrow = repm.ReadFile(@"EmailTemplates\saletemplate\en\payrow.tmp"); } } //header info invheader = invheader.Replace("[[companyname]]", MainWindow.companyName.Trim()); invheader = invheader.Replace("[[phone]]", MainWindow.Phone.Trim()); invheader = invheader.Replace("[[Email]]", MainWindow.Email.Trim()); invheader = invheader.Replace("[[fax]]", MainWindow.Fax.Trim()); invheader = invheader.Replace("[[address]]", MainWindow.Address.Trim()); invheader = invheader.Replace("[[trphone]]", MainWindow.resourcemanagerreport.GetString("trPhone").Trim() + ": "); invheader = invheader.Replace("[[trfax]]", MainWindow.resourcemanagerreport.GetString("trFax").Trim() + ": "); invheader = invheader.Replace("[[traddress]]", MainWindow.resourcemanagerreport.GetString("trAddress").Trim() + ": "); //BODY // string title = "Purchase Order"; string title = setvlist.Where(x => x.notes == "title").FirstOrDefault() is null ? "" : setvlist.Where(x => x.notes == "title").FirstOrDefault().value.ToString(); mailtosend.subject = title.Trim(); invheader = invheader.Replace("[[title]]", title.Trim()); invbody = invbody.Replace("[[thankstitle]]", title); // string thankstext = "Please provide to us,with a price list,along with your terms and conditions of sale, applicable discounts, shipping dates and additional sales and corporate policies. Should the information you provide be acceptable and competitive. "; string thankstext = setvlist.Where(x => x.notes == "text1").FirstOrDefault() is null ? "" : setvlist.Where(x => x.notes == "text1").FirstOrDefault().value.ToString(); invbody = invbody.Replace("[[thankstext]]", thankstext); if (invoice.invoiceId > 0) { if ((invoice.invType == "s" || invoice.invType == "sd" || invoice.invType == "sbd" || invoice.invType == "sb" || invoice.invType == "p" || invoice.invType == "pw")) { decimal sump = mailpayedList.Sum(x => x.cash).Value; decimal deservd = (decimal)invoice.totalNet - sump; cashTr = MainWindow.resourcemanagerreport.GetString("trCashType"); sumP = reportclass.DecTostring(sump); deservedcash = reportclass.DecTostring(deservd); invbody = invbody.Replace("[[payedsum]]", sumP); invbody = invbody.Replace("[[deservedcash]]", deservedcash); // paytable // foreach string datapayrows = ""; string paymethod = ""; payrow = payrow.Replace("[[currency]]", MainWindow.Currency); foreach (PayedInvclass row in mailpayedList) { string rowhtml = payrow; rowhtml = rowhtml.Replace("[[cashpayrow]]", reportclass.DecTostring(row.cash)); paymethod = row.processType == "cash" ? cashTr : row.cardName; rowhtml = rowhtml.Replace("[[paymethodrow]]", paymethod); datapayrows += rowhtml; } paytable = paytable.Replace("[[payrow]]", datapayrows); // end foreach invbody = invbody.Replace("[[paytable]]", paytable); } invbody = invbody.Replace("[[invoicecode]]", invoice.invNumber); invbody = invbody.Replace("[[invoicedate]]", repm.DateToString(invoice.invDate)); //invbody = invbody.Replace("[[invoicetotal]]", invoice.total.ToString()); invbody = invbody.Replace("[[invoicetotal]]", repm.DecTostring(invoice.total)); //invbody = invbody.Replace("[[invoicediscount]]", invoice.discountValue.ToString()); if (invoice.discountType == "2") { if (isArabic) { invbody = invbody.Replace("[[invoicediscount]]", "% " + repm.DecTostring(invoice.discountValue)); } else { invbody = invbody.Replace("[[invoicediscount]]", repm.DecTostring(invoice.discountValue) + " %"); } } else { if (isArabic) { invbody = invbody.Replace("[[invoicediscount]]", MainWindow.Currency + " " + repm.DecTostring(invoice.discountValue)); } else { invbody = invbody.Replace("[[invoicediscount]]", repm.DecTostring(invoice.discountValue) + " " + MainWindow.Currency); } } //invbody = invbody.Replace("[[invoicetax]]", invoice.tax.ToString()); if (invoice.tax == 0 || invoice.tax == null) { invbody = invbody.Replace("[[invoicetax]]", repm.DecTostring(invoice.tax)); invbody = invbody.Replace("[[trinvoicetax]]", MainWindow.resourcemanagerreport.GetString("trTax").Trim()); invbody = invbody.Replace("[[taxdiv]]", ""); } else { taxdiv = taxdiv.Replace("[[invoicetax]]", repm.DecTostring(invoice.tax)); taxdiv = taxdiv.Replace("[[trinvoicetax]]", MainWindow.resourcemanagerreport.GetString("trTax").Trim()); invbody = invbody.Replace("[[taxdiv]]", taxdiv); } //shipping cost section if ((invoice.invType == "s" || invoice.invType == "or" || invoice.invType == "q" || invoice.invType == "qs" || invoice.invType == "ors")) { if (invoice.shippingCost > 0) { deliverydiv = deliverydiv.Replace("[[shippingcost]]", repm.DecTostring(invoice.shippingCost)); deliverydiv = deliverydiv.Replace("[[totaldeserved]]", repm.DecTostring(invoice.totalNet)); invbody = invbody.Replace("[[totalnet]]", repm.DecTostring(invoice.totalNet - invoice.shippingCost)); invbody = invbody.Replace("[[deliverydiv]]", deliverydiv); } else { invbody = invbody.Replace("[[deliverydiv]]", ""); invbody = invbody.Replace("[[totalnet]]", repm.DecTostring(invoice.totalNet)); } } else { invbody = invbody.Replace("[[totalnet]]", repm.DecTostring(invoice.totalNet)); invbody = invbody.Replace("[[deliverydiv]]", ""); } // end shippingcost } // invoiceItems.trQuantity trQTR invitemtable = invitemtable.Replace("[[tritems]]", MainWindow.resourcemanagerreport.GetString("trItem").Trim()); invitemtable = invitemtable.Replace("[[trunit]]", MainWindow.resourcemanagerreport.GetString("trUnit").Trim()); invitemtable = invitemtable.Replace("[[trprice]]", MainWindow.resourcemanagerreport.GetString("trPrice").Trim()); invitemtable = invitemtable.Replace("[[trquantity]]", MainWindow.resourcemanagerreport.GetString("trQTR").Trim()); invitemtable = invitemtable.Replace("[[trtotalrow]]", MainWindow.resourcemanagerreport.GetString("trTotal").Trim()); invbody = invbody.Replace("[[trinvoicecode]]", MainWindow.resourcemanagerreport.GetString("trInvoiceNumber").Trim() + ": "); invbody = invbody.Replace("[[trinvoicedate]]", MainWindow.resourcemanagerreport.GetString("trDate").Trim() + ": "); // invbody = invbody.Replace("[[trinvoicetotal]]", MainWindow.resourcemanagerreport.GetString("trSum").Trim() + ": "); invbody = invbody.Replace("[[trinvoicetotal]]", MainWindow.resourcemanagerreport.GetString("trSum").Trim()); invbody = invbody.Replace("[[currency]]", MainWindow.Currency); // invbody = invbody.Replace("[[trinvoicediscount]]", MainWindow.resourcemanagerreport.GetString("trDiscount").Trim()); invbody = invbody.Replace("[[trtotalnet]]", MainWindow.resourcemanagerreport.GetString("trTotal").Trim()); // string invoicenote = "Thank you for your cooperation. We have also enclosed our procurement specifications and conditions for your review <br/> Sincerely"; string invoicenote = setvlist.Where(x => x.notes == "text2").FirstOrDefault() is null ? "" : setvlist.Where(x => x.notes == "text2").FirstOrDefault().value.ToString(); invbody = invbody.Replace("[[invoicenote]]", invoicenote); string link1 = setvlist.Where(x => x.notes == "link1text").FirstOrDefault() is null ? "" : setvlist.Where(x => x.notes == "link1text").FirstOrDefault().value.ToString(); string link2 = setvlist.Where(x => x.notes == "link2text").FirstOrDefault() is null ? "" : setvlist.Where(x => x.notes == "link2text").FirstOrDefault().value.ToString(); string link3 = setvlist.Where(x => x.notes == "link3text").FirstOrDefault() is null ? "" : setvlist.Where(x => x.notes == "link3text").FirstOrDefault().value.ToString(); invfooter = invfooter.Replace("[[support]]", link1); invfooter = invfooter.Replace("[[returnpolicy]]", link2); invfooter = invfooter.Replace("[[aboutus]]", link3); string link1url = setvlist.Where(x => x.notes == "link1url").FirstOrDefault() is null ? "" : setvlist.Where(x => x.notes == "link1url").FirstOrDefault().value.ToString(); string link2url = setvlist.Where(x => x.notes == "link2url").FirstOrDefault() is null ? "" : setvlist.Where(x => x.notes == "link2url").FirstOrDefault().value.ToString(); string link3url = setvlist.Where(x => x.notes == "link3url").FirstOrDefault() is null ? "" : setvlist.Where(x => x.notes == "link3url").FirstOrDefault().value.ToString(); invfooter = invfooter.Replace("[[supporturl]]", link1url); invfooter = invfooter.Replace("[[returnpolicyurl]]", link2url); invfooter = invfooter.Replace("[[aboutusurl]]", link3url); invfooter = invfooter.Replace("[[year]]", DateTime.Now.Year.ToString()); // invitemtable // foreach string datarows = ""; foreach (ItemTransfer row in invoiceItems) { string rowhtml = invitemrow; row.price = decimal.Parse(SectionData.DecTostring(row.price)); rowhtml = rowhtml.Replace("[[col1]]", row.itemName.Trim()); rowhtml = rowhtml.Replace("[[col2]]", row.unitName.Trim()); rowhtml = rowhtml.Replace("[[col3]]", row.price.ToString()); rowhtml = rowhtml.Replace("[[col4]]", row.quantity.ToString()); rowhtml = rowhtml.Replace("[[col5]]", (row.quantity * row.price).ToString()); // rowhtml = rowhtml.Replace("[[col4]]", (row.quantity * row.price).ToString()); datarows += rowhtml; } invitemtable = invitemtable.Replace("[[invitemrow]]", datarows); // end foreach invbody = invbody.Replace("[[invitemtable]]", invitemtable); string mailbody = invheader + invbody + invfooter; AlternateView htmlView = AlternateView.CreateAlternateViewFromString(mailbody, null, "text/html"); string testpath = repm.GetPath(@"EmailTemplates\mail.html"); // if (!File.Exists(testpath)) { // Create a file to write to. string createText = mailbody; File.WriteAllText(testpath, createText); } else { File.Delete(testpath); // Create a file to write to. string createText = mailbody; File.WriteAllText(testpath, createText); } img.path = repm.GetLogoImagePath(); img.imageId = "logo"; imgs.Add(img); img = new MailimageClass(); img.path = repm.GetPath(@"EmailTemplates\images\image-2.gif"); img.imageId = "image-2"; imgs.Add(img); foreach (MailimageClass row in imgs) { htmlView.LinkedResources.Add(mailtosend.Linkimage(@row.path, row.imageId)); } // mailtosend.htmlView = htmlView; return(mailtosend); }
private void fillColumnChart() { axcolumn.Labels = new List <string>(); List <string> names = new List <string>(); List <decimal> balances = new List <decimal>(); //var temp = balancesQuery; var result = balancesQuery.GroupBy(s => s.posId).Select(s => new { posId = s.Key, }); var tempName = balancesQuery.GroupBy(s => s.posName + "/" + s.branchName).Select(s => new { posName = s.Key }); names.AddRange(tempName.Select(nn => nn.posName)); var tempBalance = balancesQuery.GroupBy(s => s.balance).Select(s => new { balance = s.Key }); balances.AddRange(tempBalance.Select(nn => decimal.Parse(SectionData.DecTostring(nn.balance.Value)))); List <string> lable = new List <string>(); SeriesCollection columnChartData = new SeriesCollection(); List <decimal> cS = new List <decimal>(); List <string> titles = new List <string>() { MainWindow.resourcemanager.GetString("tr_Balance") }; int x = 6; if (names.Count() <= 6) { x = names.Count(); } for (int i = 0; i < x; i++) { cS.Add(balances.ToList().Skip(i).FirstOrDefault()); axcolumn.Labels.Add(names.ToList().Skip(i).FirstOrDefault()); } if (names.Count() > 6) { decimal balanceSum = 0; for (int i = 6; i < names.Count(); i++) { balanceSum = balanceSum + balances.ToList().Skip(i).FirstOrDefault(); } if (balanceSum != 0) { cS.Add(balanceSum); } axcolumn.Labels.Add(MainWindow.resourcemanager.GetString("trOthers")); } columnChartData.Add( new StackedColumnSeries { Values = cS.AsChartValues(), Title = titles[0], DataLabels = true, }); DataContext = this; cartesianChart.Series = columnChartData; }
private void fillColumnChart() { axcolumn.Labels = new List <string>(); List <string> names = new List <string>(); List <ItemTransferInvoiceTax> resultList = new List <ItemTransferInvoiceTax>(); string title = ""; #region group data by selected tab if (selectedTab == 0) { title = MainWindow.resourcemanager.GetString("trTax") + " / " + MainWindow.resourcemanager.GetString("trInvoice"); } else if (selectedTab == 1) { title = MainWindow.resourcemanager.GetString("trTax") + " / " + MainWindow.resourcemanager.GetString("trItems"); } #endregion List <string> lable = new List <string>(); SeriesCollection columnChartData = new SeriesCollection(); List <decimal> tax = new List <decimal>(); if ((chk_allBranches.IsChecked == false) && (cb_branches.SelectedIndex != -1)) { if (selectedTab == 0) { tax.Add(taxTemp.Select(b => b.invTaxVal.Value).Sum()); } if (selectedTab == 1) { tax.Add(taxTemp.Select(b => b.itemUnitTaxwithQTY.Value).Sum()); } names.AddRange(taxTemp.Where(nn => nn.branchId == (int)cb_branches.SelectedValue).Select(nn => nn.branchName)); axcolumn.Labels.Add(names.ToList().Skip(0).FirstOrDefault()); columnChartData.Add( new StackedColumnSeries { Values = tax.AsChartValues(), DataLabels = true, Title = title }); } else { int count = 0; if (selectedTab == 0) { var temp = taxTemp.GroupBy(t => t.branchId).Select(t => new { invTaxVal = t.Sum(p => decimal.Parse(SectionData.DecTostring(p.invTaxVal))), branchName = t.FirstOrDefault().branchName }); names.AddRange(temp.Select(nn => nn.branchName)); tax.AddRange(temp.Select(nn => nn.invTaxVal)); count = names.Count(); } if (selectedTab == 1) { var temp = taxTemp.GroupBy(t => t.branchId).Select(t => new { itemUnitTaxwithQTY = t.Sum(p => decimal.Parse(SectionData.DecTostring(p.itemUnitTaxwithQTY))), branchName = t.FirstOrDefault().branchName }); names.AddRange(temp.Select(nn => nn.branchName)); tax.AddRange(temp.Select(nn => nn.itemUnitTaxwithQTY)); count = names.Count(); } List <decimal> cS = new List <decimal>(); List <string> titles = new List <string>() { title }; int x = 6; if (count <= 6) { x = count; } for (int i = 0; i < x; i++) { cS.Add(tax.ToList().Skip(i).FirstOrDefault()); axcolumn.Labels.Add(names.ToList().Skip(i).FirstOrDefault()); } if (count > 6) { decimal taxSum = 0; for (int i = 6; i < count; i++) { taxSum = taxSum + tax.ToList().Skip(i).FirstOrDefault(); } if (!((taxSum == 0))) { cS.Add(taxSum); axcolumn.Labels.Add(MainWindow.resourcemanager.GetString("trOthers")); } } columnChartData.Add( new StackedColumnSeries { Values = cS.AsChartValues(), Title = titles[0], DataLabels = true, }); } DataContext = this; cartesianChart.Series = columnChartData; }
private void drawPoints(string name, int id, SeriesCollection rowChartData, char ch, List <int> otherIds) { int endYear = DateTime.Now.Year; int startYear = endYear - 1; int startMonth = DateTime.Now.Month; int endMonth = startMonth; if (dp_startDate.SelectedDate != null && dp_endDate.SelectedDate != null) { startYear = dp_startDate.SelectedDate.Value.Year; endYear = dp_endDate.SelectedDate.Value.Year; startMonth = dp_startDate.SelectedDate.Value.Month; endMonth = dp_endDate.SelectedDate.Value.Month; } SeriesCollection columnChartData = new SeriesCollection(); List <decimal> profitLst = new List <decimal>(); if (endYear - startYear <= 1) { for (int year = startYear; year <= endYear; year++) { for (int month = startMonth; month <= 12; month++) { var firstOfThisMonth = new DateTime(year, month, 1); var firstOfNextMonth = firstOfThisMonth.AddMonths(1); if (selectedTab == 0) { if (ch == 'n') { var drawProfit = profitsQuery.ToList().Where(c => c.updateDate > firstOfThisMonth && c.updateDate <= firstOfNextMonth && c.branchCreatorId.Value == id) .Select(b => b.invoiceProfit).Sum(); profitLst.Add(decimal.Parse(SectionData.DecTostring(drawProfit))); } else if (ch == 'o') { decimal sum = 0; for (int i = 0; i < otherIds.Count; i++) { var drawProfit = profitsQuery.ToList().Where(c => c.updateDate > firstOfThisMonth && c.updateDate <= firstOfNextMonth && c.branchCreatorId.Value == otherIds[i]) .Select(b => b.invoiceProfit).Sum(); sum = sum + drawProfit; } profitLst.Add(decimal.Parse(SectionData.DecTostring(sum))); } } else if (selectedTab == 1) { if (ch == 'n') { var drawProfit = profitsQuery.ToList().Where(c => c.updateDate > firstOfThisMonth && c.updateDate <= firstOfNextMonth && c.ITitemId.Value == id) .Select(b => b.itemunitProfit).Sum(); profitLst.Add(decimal.Parse(SectionData.DecTostring(drawProfit))); } else if (ch == 'o') { decimal sum = 0; for (int i = 0; i < otherIds.Count; i++) { var drawProfit = profitsQuery.ToList().Where(c => c.updateDate > firstOfThisMonth && c.updateDate <= firstOfNextMonth && c.ITitemId.Value == otherIds[i]) .Select(b => b.itemunitProfit).Sum(); sum = sum + drawProfit; } profitLst.Add(decimal.Parse(SectionData.DecTostring(sum))); } } MyAxis.Labels.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(month) + "/" + year); if (year == endYear && month == endMonth) { break; } if (month == 12) { startMonth = 1; break; } } } } else { for (int year = startYear; year <= endYear; year++) { var firstOfThisYear = new DateTime(year, 1, 1); var firstOfNextMYear = firstOfThisYear.AddYears(1); if (selectedTab == 0) { if (ch == 'n') { var drawProfit = profitsQuery.ToList().Where(c => c.updateDate > firstOfThisYear && c.updateDate <= firstOfNextMYear && c.branchCreatorId.Value == id) .Select(b => b.invoiceProfit).Sum(); profitLst.Add(decimal.Parse(SectionData.DecTostring(drawProfit))); } else if (ch == 'o') { decimal sum = 0; for (int i = 0; i < otherIds.Count; i++) { var drawProfit = profitsQuery.ToList().Where(c => c.updateDate > firstOfThisYear && c.updateDate <= firstOfNextMYear && c.branchCreatorId.Value == otherIds[i]) .Select(b => b.invoiceProfit).Sum(); sum = sum + drawProfit; } profitLst.Add(decimal.Parse(SectionData.DecTostring(sum))); } } else if (selectedTab == 1) { if (ch == 'n') { var drawProfit = profitsQuery.ToList().Where(c => c.updateDate > firstOfThisYear && c.updateDate <= firstOfNextMYear && c.ITitemId.Value == id) .Select(b => b.itemunitProfit).Sum(); profitLst.Add(decimal.Parse(SectionData.DecTostring(drawProfit))); } else if (ch == 'o') { decimal sum = 0; for (int i = 0; i < otherIds.Count; i++) { var drawProfit = profitsQuery.ToList().Where(c => c.updateDate > firstOfThisYear && c.updateDate <= firstOfNextMYear && c.ITitemId.Value == otherIds[i]) .Select(b => b.itemunitProfit).Sum(); sum = sum + drawProfit; } profitLst.Add(decimal.Parse(SectionData.DecTostring(sum))); } } MyAxis.Labels.Add(year.ToString()); } } rowChartData.Add( new LineSeries { Values = profitLst.AsChartValues(), Title = name }); }
private void fillPieChart() { List <string> titles = new List <string>(); List <string> finalTitles = new List <string>(); IEnumerable <decimal> x = null; var temp = profitsQuery; int count = 0; if (selectedTab == 0) { var titleTemp = temp.GroupBy(m => m.branchCreatorName); titles.AddRange(titleTemp.Select(jj => jj.Key)); var result = temp.GroupBy(s => s.branchCreatorId).Select(s => new { branchCreatorId = s.Key, profit = s.Sum(p => p.invoiceProfit) }); x = result.Select(m => decimal.Parse(SectionData.DecTostring(m.profit))); count = x.Count(); } else if (selectedTab == 1) { var titleTemp = temp.GroupBy(m => m.ITitemId).Select(d => new { ITitemId = d.Key, name = d.FirstOrDefault().ITitemName } ); titles.AddRange(titleTemp.Select(jj => jj.name)); var result = temp.GroupBy(s => s.ITitemId).Select(s => new { ITitemUnitId = s.Key, profit = s.Sum(p => p.itemunitProfit) }); x = result.Select(m => decimal.Parse(SectionData.DecTostring(m.profit))); count = x.Count(); } SeriesCollection piechartData = new SeriesCollection(); int xCount = 6; if (count < 6) { xCount = count; } for (int i = 0; i < xCount; i++) { List <decimal> final = new List <decimal>(); if (x.ToList().Skip(i).FirstOrDefault() > 0) { final.Add(x.ToList().Skip(i).FirstOrDefault()); finalTitles.Add(titles[i]); piechartData.Add( new PieSeries { Values = final.AsChartValues(), Title = finalTitles.Skip(i).FirstOrDefault(), DataLabels = true, } ); } } if (count > 6) { decimal finalSum = 0; for (int i = 6; i < count; i++) { finalSum = finalSum + x.ToList().Skip(i).FirstOrDefault(); } List <decimal> final = new List <decimal>(); List <string> lable = new List <string>(); if (finalSum > 0) { final.Add(finalSum); } piechartData.Add( new PieSeries { Values = final.AsChartValues(), Title = MainWindow.resourcemanager.GetString("trOthers"), DataLabels = true, } ); } chart1.Series = piechartData; }
private void fillColumnChart() { axcolumn.Labels = new List <string>(); List <string> names = new List <string>(); List <decimal> profit = new List <decimal>(); var temp = profitsQuery; int count = 0; //invoice if (selectedTab == 0) { var tempName = temp.GroupBy(s => s.posId).Select(s => new { posName = s.FirstOrDefault().posName + "/" + s.FirstOrDefault().branchCreatorName }); count = tempName.Count(); names.AddRange(tempName.Select(nn => nn.posName)); var tempProfit = temp.GroupBy(s => s.posId).Select(s => new { profit = s.Sum(p => decimal.Parse(SectionData.DecTostring(p.invoiceProfit))) }); profit.AddRange(tempProfit.Select(nn => nn.profit)); } //item else if (selectedTab == 1) { var tempName = temp.GroupBy(s => s.ITitemUnitId).Select(s => new { name = s.FirstOrDefault().ITitemName + "/" + s.FirstOrDefault().ITunitName }); count = tempName.Count(); names.AddRange(tempName.Select(nn => nn.name)); var tempProfit = temp.GroupBy(s => s.ITitemId).Select(s => new { profit = s.Sum(p => decimal.Parse(SectionData.DecTostring(p.itemunitProfit))) }); profit.AddRange(tempProfit.Select(nn => nn.profit)); } List <string> lable = new List <string>(); SeriesCollection columnChartData = new SeriesCollection(); List <decimal> cWon = new List <decimal>(); List <decimal> cLoss = new List <decimal>(); List <string> titles = new List <string>() { MainWindow.resourcemanager.GetString("trProfit"), MainWindow.resourcemanager.GetString("trLoss") }; int x = 6; if (count <= 6) { x = count; } for (int i = 0; i < x; i++) { if (profit.ToList().Skip(i).FirstOrDefault() > 0) { cWon.Add(profit.ToList().Skip(i).FirstOrDefault()); cLoss.Add(0); } else { cWon.Add(0); cLoss.Add(-1 * profit.ToList().Skip(i).FirstOrDefault()); } axcolumn.Labels.Add(names.ToList().Skip(i).FirstOrDefault()); } if (count > 6) { decimal profitSum = 0; for (int i = 6; i < count; i++) { profitSum = profitSum + profit.ToList().Skip(i).FirstOrDefault(); } if (!((profitSum == 0))) { if (profitSum > 0) { cWon.Add(profitSum); cLoss.Add(0); } else { cWon.Add(0); cLoss.Add(-1 * profitSum); } axcolumn.Labels.Add(MainWindow.resourcemanager.GetString("trOthers")); } } columnChartData.Add( new StackedColumnSeries { Values = cWon.AsChartValues(), Title = titles[0], DataLabels = true, }); columnChartData.Add( new StackedColumnSeries { Values = cLoss.AsChartValues(), Title = titles[1], DataLabels = true, }); DataContext = this; cartesianChart.Series = columnChartData; }
private void Btn_exportToExcel_Click(object sender, RoutedEventArgs e) {//export try { if (sender != null) { SectionData.StartAwait(grid_main); } if (MainWindow.groupObject.HasPermissionAction(basicsPermission, MainWindow.groupObjects, "report") || SectionData.isAdminPermision()) { #region //Thread t1 = new Thread(() => //{ List <ReportParameter> paramarr = new List <ReportParameter>(); string addpath; bool isArabic = ReportCls.checkLang(); if (isArabic) { addpath = @"\Reports\Catalog\Ar\ArStorageCostReport.rdlc"; } else { addpath = @"\Reports\Catalog\En\StorageCostReport.rdlc"; } string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath); ReportCls.checkLang(); foreach (var r in storageCostQuery) { r.cost = decimal.Parse(SectionData.DecTostring(r.cost)); } clsReports.storageCostReport(storageCostQuery, rep, reppath, paramarr); clsReports.setReportLanguage(paramarr); clsReports.Header(paramarr); rep.SetParameters(paramarr); rep.Refresh(); this.Dispatcher.Invoke(() => { saveFileDialog.Filter = "EXCEL|*.xls;"; if (saveFileDialog.ShowDialog() == true) { string filepath = saveFileDialog.FileName; LocalReportExtensions.ExportToExcel(rep, filepath); } }); //}); //t1.Start(); #endregion } else { Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn); } if (sender != null) { SectionData.EndAwait(grid_main); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_main); } SectionData.ExceptionMessage(ex, this); } }
void CreateItemCard() { #region Grid Container Grid gridContainer = new Grid(); ColumnDefinition[] cd = new ColumnDefinition[2]; for (int i = 0; i < 2; i++) { cd[i] = new ColumnDefinition(); } cd[0].Width = new GridLength(1.2, GridUnitType.Star); cd[1].Width = new GridLength(1, GridUnitType.Star); for (int i = 0; i < 2; i++) { gridContainer.ColumnDefinitions.Add(cd[i]); } //int rowCount = 3; //if (cardViewitem.cardType == "sales") int rowCount = 5; RowDefinition[] rd = new RowDefinition[5]; for (int i = 0; i < rowCount; i++) { rd[i] = new RowDefinition(); } rd[0].Height = new GridLength(1, GridUnitType.Star); rd[1].Height = new GridLength(20, GridUnitType.Pixel); rd[2].Height = new GridLength(20, GridUnitType.Pixel); rd[3].Height = new GridLength(20, GridUnitType.Pixel); //if (cardViewitem.cardType == "sales") rd[4].Height = new GridLength(20, GridUnitType.Star); for (int i = 0; i < rowCount; i++) { gridContainer.RowDefinitions.Add(rd[i]); } ///////////////////////////////////////////////////// if (this.ActualHeight != 0) { gridContainer.Height = this.ActualHeight - 10; } if (this.ActualHeight != 0) { gridContainer.Width = this.ActualWidth - 10; } ///////////////////////////////////////////////////// brd_main.Child = gridContainer; #endregion if (MainWindow.lang.Equals("en")) { grid_main.FlowDirection = FlowDirection.LeftToRight; } else { grid_main.FlowDirection = FlowDirection.RightToLeft; } #region Title var titleText = new TextBlock(); titleText.Text = cardViewitem.item.name; titleText.FontSize = 13; titleText.Height = 20; titleText.FontFamily = App.Current.Resources["Font-cairo-bold"] as FontFamily; titleText.Margin = new Thickness(5, 0, 5, 0); titleText.FontWeight = FontWeights.Bold; titleText.VerticalAlignment = VerticalAlignment.Top; titleText.HorizontalAlignment = HorizontalAlignment.Left; titleText.TextWrapping = TextWrapping.Wrap; titleText.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#6e6e6e")); Grid.SetRow(titleText, 1); ///////////////////////////////// #endregion #region subTitle var subTitleText = new TextBlock(); subTitleText.Text = cardViewitem.item.details; subTitleText.Margin = new Thickness(5, 0, 5, 0); subTitleText.FontWeight = FontWeights.Regular; subTitleText.VerticalAlignment = VerticalAlignment.Center; subTitleText.HorizontalAlignment = HorizontalAlignment.Left; subTitleText.Height = 18; subTitleText.FontSize = 10; subTitleText.TextWrapping = TextWrapping.Wrap; subTitleText.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#6e6e6e")); Grid.SetRow(subTitleText, 2); ///////////////////////////////// #endregion #region subTitle var countText = new TextBlock(); if (cardViewitem.item.itemCount == null) { countText.Text = ""; } else { if (cardViewitem.item.type != "sr") { countText.Text = cardViewitem.item.itemCount + " " + cardViewitem.item.unitName; } else { countText.Text = MainWindow.resourcemanager.GetString("trService"); } } countText.Margin = new Thickness(5, 0, 5, 0); countText.FontWeight = FontWeights.Regular; countText.VerticalAlignment = VerticalAlignment.Center; countText.HorizontalAlignment = HorizontalAlignment.Left; subTitleText.Height = 18; countText.FontSize = 10; countText.TextWrapping = TextWrapping.Wrap; countText.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#6e6e6e")); Grid.SetRow(countText, 3); ///////////////////////////////// #endregion #region Price if (cardViewitem.cardType == "sales") { Grid gridPrice = new Grid(); Grid.SetRow(gridPrice, 4); //70 gridPrice.Width = gridContainer.Width / 2; //25 gridPrice.Height = gridContainer.Height / 4; gridPrice.HorizontalAlignment = HorizontalAlignment.Left; gridPrice.Margin = new Thickness(5, 2.5, 5, 5); ///////////////////////////// Rectangle rectanglePrice = new Rectangle(); rectanglePrice.Fill = (SolidColorBrush)(new BrushConverter().ConvertFrom("#178DD2")); rectanglePrice.RadiusX = 4; rectanglePrice.RadiusY = 4; gridPrice.Children.Add(rectanglePrice); //////////////////////////////// var priceText = new TextBlock(); //priceText.Text = cardViewitem.item.priceTax.ToString(); try { if (MainWindow.itemsTax_bool == true) { priceText.Text = SectionData.DecTostring(cardViewitem.item.priceTax); } else { priceText.Text = SectionData.DecTostring(cardViewitem.item.price); } } catch { priceText.Text = ""; } priceText.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFFFFF")); priceText.FontWeight = FontWeights.Bold; priceText.VerticalAlignment = VerticalAlignment.Center; priceText.HorizontalAlignment = HorizontalAlignment.Center; priceText.FontSize = 14; gridPrice.Children.Add(priceText); ///////////////////////////////// gridContainer.Children.Add(gridPrice); } #endregion #region Image Item item = new Item(); Button buttonImage = new Button(); buttonImage.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFFFFF")); //buttonImage.Height = (gridContainer.Height) - 7.5; //buttonImage.Width = (gridContainer.Width / 2.2) - 7.5; buttonImage.Height = (gridContainer.Height / 1.1) - 7.5; buttonImage.Width = ((gridContainer.Width / 2.2) / 1.2) - 7.5; buttonImage.BorderThickness = new Thickness(0); buttonImage.Padding = new Thickness(0); buttonImage.FlowDirection = FlowDirection.LeftToRight; MaterialDesignThemes.Wpf.ButtonAssist.SetCornerRadius(buttonImage, (new CornerRadius(10))); bool isModified = SectionData.chkImgChng(cardViewitem.item.image, (DateTime)cardViewitem.item.updateDate, Global.TMPItemsFolder); if (isModified) { SectionData.getImg("Item", cardViewitem.item.image, buttonImage); } else { SectionData.getLocalImg("Item", cardViewitem.item.image, buttonImage); } Grid grid_image = new Grid(); grid_image.Height = buttonImage.Height - 2; grid_image.Width = buttonImage.Width - 1; Grid.SetRowSpan(grid_image, 5); Grid.SetColumn(grid_image, 1); grid_image.Children.Add(buttonImage); gridContainer.Children.Add(grid_image); ////////////// #endregion if (cardViewitem.item.isNew == 1) { /* #region Path Star * //string dataStar = ""; * Path pathStar = new Path(); * Grid.SetRowSpan(pathStar, 5); * pathStar.Fill = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFA926")); * pathStar.Stretch = Stretch.Fill; * Grid.SetColumnSpan(pathStar, 2); * pathStar.Height = 18; * pathStar.Width = 54; * pathStar.VerticalAlignment = VerticalAlignment.Bottom; * pathStar.HorizontalAlignment = HorizontalAlignment.Right; * pathStar.FlowDirection = FlowDirection.LeftToRight; * pathStar.Margin = new Thickness(7.5); * pathStar.Data = App.Current.Resources["NewIconGeometry"] as Geometry; #endregion * gridContainer.Children.Add(pathStar); */ #region Path newLabel Path pathNewLabel = new Path(); Grid.SetRowSpan(pathNewLabel, 5); pathNewLabel.Fill = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D20707")); pathNewLabel.Stretch = Stretch.Fill; Grid.SetColumnSpan(pathNewLabel, 2); //pathStar.Height = 18; //pathStar.Width = 54; //pathNewLabel.VerticalAlignment = VerticalAlignment.Bottom; //pathNewLabel.HorizontalAlignment = HorizontalAlignment.Right; pathNewLabel.FlowDirection = FlowDirection.LeftToRight; //pathNewLabel.Margin = new Thickness(7.5); pathNewLabel.Data = App.Current.Resources["newBlock"] as Geometry; pathNewLabel.Width = gridContainer.Width / 6.5; pathNewLabel.Height = pathNewLabel.Width / 3; #region Text Path pathNewLabelText = new Path(); Grid.SetRowSpan(pathNewLabelText, 5); pathNewLabelText.Fill = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFFD00")); pathNewLabelText.Stretch = Stretch.Fill; Grid.SetColumnSpan(pathNewLabelText, 2); //pathNewLabelText.VerticalAlignment = VerticalAlignment.Bottom; //pathNewLabelText.HorizontalAlignment = HorizontalAlignment.Right; pathNewLabelText.FlowDirection = FlowDirection.LeftToRight; //pathNewLabelText.Margin = new Thickness(7.5); //pathNewLabelText.Margin = new Thickness(0, 0, 12.5, 10); pathNewLabelText.Data = App.Current.Resources["newText"] as Geometry; //pathStar.Height = 18; //pathStar.Width = 54; pathNewLabelText.Width = gridContainer.Width / 10; pathNewLabelText.Height = pathNewLabelText.Width / 3; #endregion #endregion Grid gridNewContainer = new Grid(); Grid.SetRowSpan(gridNewContainer, 5); Grid.SetColumnSpan(gridNewContainer, 2); gridNewContainer.VerticalAlignment = VerticalAlignment.Bottom; gridNewContainer.HorizontalAlignment = HorizontalAlignment.Right; gridNewContainer.Margin = new Thickness(7.5); gridNewContainer.Children.Add(pathNewLabel); gridNewContainer.Children.Add(pathNewLabelText); gridContainer.Children.Add(gridNewContainer); //gridContainer.Children.Add(pathNewLabel); //gridContainer.Children.Add(pathNewLabelText); } if (cardViewitem.item.isOffer == 1) { #region Path offerLabel //string dataStar = ""; Path pathOfferLabel = new Path(); Grid.SetColumnSpan(pathOfferLabel, 2); Grid.SetRowSpan(pathOfferLabel, 5); pathOfferLabel.Fill = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D20707")); pathOfferLabel.VerticalAlignment = VerticalAlignment.Top; pathOfferLabel.Stretch = Stretch.Fill; // Height = "16" Width = "86" pathOfferLabel.Height = pathOfferLabel.Width = gridContainer.Width / 4.5; pathOfferLabel.FlowDirection = FlowDirection.LeftToRight; pathOfferLabel.HorizontalAlignment = HorizontalAlignment.Right; if (MainWindow.lang.Equals("ar")) { pathOfferLabel.Data = App.Current.Resources["offerLabelArTopLeft"] as Geometry; } else { pathOfferLabel.Data = App.Current.Resources["offerLabelEnTopRight"] as Geometry; } #region Text Path pathOfferLabelText = new Path(); Grid.SetColumnSpan(pathOfferLabelText, 2); Grid.SetRowSpan(pathOfferLabelText, 5); pathOfferLabelText.FlowDirection = FlowDirection.LeftToRight; pathOfferLabelText.VerticalAlignment = VerticalAlignment.Top; pathOfferLabelText.Fill = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFFD00")); pathOfferLabelText.Stretch = Stretch.Fill; pathOfferLabelText.HorizontalAlignment = HorizontalAlignment.Right; if (MainWindow.lang.Equals("ar")) { pathOfferLabelText.Height = pathOfferLabelText.Width = gridContainer.Width / 7; pathOfferLabelText.Margin = new Thickness(0, 4, 4, 0); pathOfferLabelText.Data = App.Current.Resources["offerLabelArTopLeft_Text"] as Geometry; } else { pathOfferLabelText.Height = pathOfferLabelText.Width = gridContainer.Width / 6.5; pathOfferLabelText.Margin = new Thickness(0, 2.5, 2.5, 0); pathOfferLabelText.Data = App.Current.Resources["offerLabelEnTopRight_Text"] as Geometry; } #endregion #endregion gridContainer.Children.Add(pathOfferLabel); gridContainer.Children.Add(pathOfferLabelText); } if (cardViewitem.item.itemCount > 0) { this.ToolTip = MainWindow.resourcemanager.GetString("trCount: ") + cardViewitem.item.itemCount + " " + cardViewitem.item.unitName; //tt_name.Content = "Count" + cardViewitem.item.itemCount; } gridContainer.Children.Add(titleText); gridContainer.Children.Add(subTitleText); gridContainer.Children.Add(countText); }
void RefreshCashView() { dg_accounts.ItemsSource = cashesQuery; tb_paid.Text = SectionData.DecTostring(invPaid); tb_total.Text = SectionData.DecTostring(invTotal); }
private void Dg_storageCost_SelectionChanged(object sender, SelectionChangedEventArgs e) {//selection try { if (sender != null) { SectionData.StartAwait(grid_main); } SectionData.clearValidate(tb_name, p_errorName); SectionData.clearValidate(tb_cost, p_errorCost); if (dg_storageCost.SelectedIndex != -1) { storageCost = dg_storageCost.SelectedItem as StorageCost; this.DataContext = storageCost; if (storageCost != null) { tb_cost.Text = SectionData.DecTostring(storageCost.cost); #region delete if (storageCost.canDelete) { txt_deleteButton.Text = MainWindow.resourcemanager.GetString("trDelete"); txt_delete_Icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Delete; tt_delete_Button.Content = MainWindow.resourcemanager.GetString("trDelete"); } else { if (storageCost.isActive == 0) { txt_deleteButton.Text = MainWindow.resourcemanager.GetString("trActive"); txt_delete_Icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Check; tt_delete_Button.Content = MainWindow.resourcemanager.GetString("trActive"); } else { txt_deleteButton.Text = MainWindow.resourcemanager.GetString("trInActive"); txt_delete_Icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Cancel; tt_delete_Button.Content = MainWindow.resourcemanager.GetString("trInActive"); } } #endregion } } if (sender != null) { SectionData.EndAwait(grid_main); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_main); } SectionData.ExceptionMessage(ex, this); } }