public print(List <ClassCheck.localTypesPay> typePay, string nameTicketWindow) { this.typePay = typePay; this.nameTicketWindow = nameTicketWindow; int X = 0; int Y = 0; int H = size; int W = 280; elm n = new elm(); n.rectangle = new Rectangle(X, Y, W, H); n.stringFormat.Alignment = StringAlignment.Near; n.stringFormat.LineAlignment = StringAlignment.Near; n.text = nameTicketWindow + "(" + DateTime.Now + ")"; E.Add(n); Y += H; foreach (ClassCheck.localTypesPay t in typePay) { Y += H; elm nl = new elm(); nl.rectangle = new Rectangle(X, Y, W / 2, H); nl.stringFormat.Alignment = StringAlignment.Near; nl.stringFormat.LineAlignment = StringAlignment.Near; nl.text = t.type.Name; E.Add(nl); elm nr = new elm(); nr.rectangle = new Rectangle(X + W / 2, Y, W / 2, H); nr.stringFormat.Alignment = StringAlignment.Far; nr.stringFormat.LineAlignment = StringAlignment.Near; nr.text = t.value.ToString("0.00"); E.Add(nr); } }
public static elm[,] gridCurrencyPath_get_path(ClassSync.TypesPayDB tp) { elm[,] r = new elm[12, 12]; foreach (elm[,] elm in gridCurrencyPath) { if ((elm[0, 0] != null) && (elm[0, 0].path == System.AppDomain.CurrentDomain.BaseDirectory + @"\Data\" + tp.Id + ".xml")) { r = elm; } } return(r); }
int _GetElmCheckState(elm e) { var state = e.State; if (state.Has(EState.MIXED)) { return(2); } if (state.Has(EState.CHECKED)) { return(1); } return(0); }
public void DrawPaiements(List <ClassPrintCheck.Pays> LPays, int posX, int posY, out int posXo, out int posYo) { int countPay = 0; int sizeLine = 15; foreach (var e in LPays) { if (e.money > 0) { countPay++; elm eNamePay = new elm(); eNamePay.font = new Font("Arial", 9); eNamePay.text = e.type.Name; eNamePay.rectangle = new Rectangle(posX + 20, posY, 150, sizeLine); eNamePay.stringFormat = new StringFormat(); eNamePay.stringFormat.Alignment = StringAlignment.Near; eNamePay.stringFormat.LineAlignment = StringAlignment.Center; elm eMoney = new elm(); eMoney.font = new Font("Arial", 9); eMoney.text = e.money.ToString("0.00 €"); eMoney.rectangle = new Rectangle(posX + 170, posY, 90, sizeLine); eMoney.stringFormat = new StringFormat(); eMoney.stringFormat.Alignment = StringAlignment.Far; eMoney.stringFormat.LineAlignment = StringAlignment.Center; LPay.Add(eNamePay); LPay.Add(eMoney); posY += sizeLine; } } posXo = posX; posYo = posY; }
private void load(string path) { XDocument xmlGrid = XDocument.Load(path); for (int I = 0; I < 12; I++) { for (int J = 0; J < 12; J++) { List <XElement> x_elms = (from el in xmlGrid.Elements("GridStatistique_Region_et_Pays").Elements("_" + I + "x" + J).Elements("rec") select el).ToList(); elm[] e = new elm[x_elms.Count]; foreach (XElement x in x_elms) { elm f = new elm(); f.x = byte.Parse(x.Element("X").Value); f.y = byte.Parse(x.Element("Y").Value); f.NameCountry = x.Element("NameCountry").Value; string[] rgbt = x.Element("background").Value.Split(','); try { f.background = new SolidColorBrush(Color.FromRgb(byte.Parse(rgbt[0]), byte.Parse(rgbt[1]), byte.Parse(rgbt[2]))); } catch { f.background = new SolidColorBrush(Color.FromRgb(0, 255, 255)); } f.font = x.Element("font").Value; f.customerId = x.Element("customerId") != null?Guid.Parse(x.Element("customerId").Value) : Guid.Empty; grid[I, J, f.x, f.y] = f; } } } }
/// <summary>Specifies a UI element and a rectangle in it.</summary> public IFArea(elm e, RECT r) { Type = AreaType.Elm; E = e; R = r; HasRect = true; }
public void DrawTva(int posX, int posY, out int posXo, out int posYo) { int count = 0; int sizeLine = 11; foreach (mTva m in ltva) { if (m.tva > 0.0m) { count++; elm eNameTva = new elm(); eNameTva.font = new Font("Arial", 8); eNameTva.text = "TVA " + m.val + "% :"; eNameTva.rectangle = new Rectangle(posX + 20, posY, 60, sizeLine); eNameTva.stringFormat = new StringFormat(); eNameTva.stringFormat.Alignment = StringAlignment.Near; eNameTva.stringFormat.LineAlignment = StringAlignment.Center; elm eTva = new elm(); eTva.font = new Font("Arial", 8); eTva.text = m.tva.ToString("0.00 €"); eTva.rectangle = new Rectangle(posX + 80, posY, 60, sizeLine); eTva.stringFormat = new StringFormat(); eTva.stringFormat.Alignment = StringAlignment.Far; eTva.stringFormat.LineAlignment = StringAlignment.Center; elm eHtName = new elm(); eHtName.font = new Font("Arial", 8); eHtName.text = "HT : "; eHtName.rectangle = new Rectangle(posX + 150, posY, 60, sizeLine); eHtName.stringFormat = new StringFormat(); eHtName.stringFormat.Alignment = StringAlignment.Near; eHtName.stringFormat.LineAlignment = StringAlignment.Center; elm eHt = new elm(); eHt.font = new Font("Arial", 8); eHt.text = m.ht.ToString("0.00 €"); eHt.rectangle = new Rectangle(posX + 210, posY, 60, sizeLine); eHt.stringFormat = new StringFormat(); eHt.stringFormat.Alignment = StringAlignment.Far; eHt.stringFormat.LineAlignment = StringAlignment.Center; listEl.Add(eHtName); listEl.Add(eHt); listEl.Add(eNameTva); listEl.Add(eTva); posY += sizeLine; } } if (count > 1) { elm eNameTvaS = new elm(); eNameTvaS.font = new Font("Arial", 8); eNameTvaS.text = "Total TVA :"; eNameTvaS.rectangle = new Rectangle(posX + 20, posY, 60, sizeLine); eNameTvaS.stringFormat = new StringFormat(); eNameTvaS.stringFormat.Alignment = StringAlignment.Near; eNameTvaS.stringFormat.LineAlignment = StringAlignment.Center; elm eTvaS = new elm(); eTvaS.font = new Font("Arial", 8); eTvaS.text = ltva.Sum(l => l.tva).ToString("0.00 €"); eTvaS.rectangle = new Rectangle(posX + 80, posY, 60, sizeLine); eTvaS.stringFormat = new StringFormat(); eTvaS.stringFormat.Alignment = StringAlignment.Far; eTvaS.stringFormat.LineAlignment = StringAlignment.Center; elm eHtNameS = new elm(); eHtNameS.font = new Font("Arial", 8); eHtNameS.text = "Total HT : "; eHtNameS.rectangle = new Rectangle(posX + 150, posY, 60, sizeLine); eHtNameS.stringFormat = new StringFormat(); eHtNameS.stringFormat.Alignment = StringAlignment.Near; eHtNameS.stringFormat.LineAlignment = StringAlignment.Center; elm eHtS = new elm(); eHtS.font = new Font("Arial", 8); eHtS.text = ltva.Sum(l => l.ht).ToString("0.00 €"); eHtS.rectangle = new Rectangle(posX + 210, posY, 60, sizeLine); eHtS.stringFormat = new StringFormat(); eHtS.stringFormat.Alignment = StringAlignment.Far; eHtS.stringFormat.LineAlignment = StringAlignment.Center; listEl.Add(eHtNameS); listEl.Add(eHtS); listEl.Add(eNameTvaS); listEl.Add(eTvaS); posY += sizeLine; } posXo = posX; posYo = posY; }
// public List<Paiements> listPaiements = new List<Paiements>(); public void DrawElm(List <ClassPrintCheck.groupProduct> lProduct, int posX, int posY, out int posXo, out int posYo) { foreach (ClassTVA.tva t in ClassTVA.listTVA) { mTva n = new mTva(); n.id = t.id; n.val = t.val; n.ht = 0.0m; n.tva = 0.0m; ltva.Add(n); } foreach (ClassPrintCheck.groupProduct g in lProduct) { int sizeLine = 15; elm e = new elm(); e.font = new Font("Arial", 8, FontStyle.Bold); e.text = g.categories; e.rectangle = new Rectangle(posX + 10, posY, 270, sizeLine); e.stringFormat = new StringFormat(); e.stringFormat.Alignment = StringAlignment.Near; e.stringFormat.LineAlignment = StringAlignment.Far; posY += sizeLine; listEl.Add(e); for (int i = 0; i < g.products.Count; i++) { elm emName = new elm(); emName.text = g.products[i].name; if (emName.text.Length > 30) { emName.text = emName.text.Substring(0, 30); } emName.font = new Font("Arial", 10); emName.rectangle = new Rectangle(posX, posY, 225, sizeLine); emName.stringFormat = new StringFormat(); emName.stringFormat.Alignment = StringAlignment.Near; emName.stringFormat.LineAlignment = StringAlignment.Center; listEl.Add(emName); elm emPrice = new elm(); emPrice.text = g.products[i].total.ToString("0.00"); emPrice.font = new Font("Arial", 10); emPrice.rectangle = new Rectangle(posX + 220, posY, 60, sizeLine); emPrice.stringFormat = new StringFormat(); emPrice.stringFormat.Alignment = StringAlignment.Far; emPrice.stringFormat.LineAlignment = StringAlignment.Center; listEl.Add(emPrice); int indx = ltva.FindIndex(l => l.id == g.products[i].tva); if (indx != -1) { ltva[indx].tva += g.products[i].TvaTotal; ltva[indx].ht += g.products[i].HT; } posY += sizeLine; if (g.products[i].qty != 1) { elm emQTY = new elm(); int iqty = (int)g.products[i].qty; if (iqty - g.products[i].qty != 0.0M) { emQTY.text = g.products[i].qty.ToString("0.000") + "kg x " + g.products[i].price + " €"; } else { emQTY.text = " " + iqty.ToString() + " x " + g.products[i].price + " €"; } emQTY.font = new Font("Arial", 8); emQTY.rectangle = new Rectangle(posX + 10, posY - 3, 250, sizeLine); emQTY.stringFormat = new StringFormat(); emQTY.stringFormat.Alignment = StringAlignment.Near; emQTY.stringFormat.LineAlignment = StringAlignment.Near; listEl.Add(emQTY); posY += 10; } } } posXo = posX; posYo = posY; }
// public static elm[,] gridEvro = new elm[12, 12]; public elm[,] load(string path) { elm[,] g = new elm[12, 12]; XDocument xmlGrid = XDocument.Load(path); List <XElement> x_id = (from el in xmlGrid.Elements("Grid").Elements("rec").Elements("id") select el).ToList(); List <XElement> x_Date_upd = (from el in xmlGrid.Elements("Grid").Elements("rec").Elements("Date_upd") select el).ToList(); List <XElement> x_X = (from el in xmlGrid.Elements("Grid").Elements("rec").Elements("X") select el).ToList(); List <XElement> x_Y = (from el in xmlGrid.Elements("Grid").Elements("rec").Elements("Y") select el).ToList(); List <XElement> x_Caption = (from el in xmlGrid.Elements("Grid").Elements("rec").Elements("Caption") select el).ToList(); List <XElement> x_Color = (from el in xmlGrid.Elements("Grid").Elements("rec").Elements("Color") select el).ToList(); List <XElement> x_Img = (from el in xmlGrid.Elements("Grid").Elements("rec").Elements("Img") select el).ToList(); List <XElement> x_Func = (from el in xmlGrid.Elements("Grid").Elements("rec").Elements("Fun") select el).ToList(); List <XElement> x_foreground = (from el in xmlGrid.Elements("Grid").Elements("rec").Elements("foreground") select el).ToList(); elm[] e = new elm[x_id.Count]; for (int i = 0; i < e.Length; i++) { elm f = new elm(); f.x = byte.Parse(x_X[i].Value); f.y = byte.Parse(x_Y[i].Value); f.caption = x_Caption[i].Value; string[] argbt = x_Color[i].Value.Split(','); string[] argbt_ = x_foreground.Count != e.Length ? new string[4] { "255", "255", "255", "255" } : x_foreground[i].Value.Split(','); // try { if (argbt.Length == 0) { f.background = null; } if (argbt.Length == 4) { f.background = new SolidColorBrush(Color.FromArgb(byte.Parse(argbt[0]), byte.Parse(argbt[1]), byte.Parse(argbt[2]), byte.Parse(argbt[3]))); } if (argbt.Length == 3) { f.background = new SolidColorBrush(Color.FromRgb(byte.Parse(argbt[0]), byte.Parse(argbt[1]), byte.Parse(argbt[2]))); } if (argbt_.Length == 0) { f.foreground = null; } if (argbt_.Length == 4) { f.foreground = new SolidColorBrush(Color.FromArgb(byte.Parse(argbt_[0]), byte.Parse(argbt_[1]), byte.Parse(argbt_[2]), byte.Parse(argbt_[3]))); } if (argbt_.Length == 3) { f.foreground = new SolidColorBrush(Color.FromRgb(byte.Parse(argbt_[0]), byte.Parse(argbt_[1]), byte.Parse(argbt_[2]))); } } // catch { // f.background = new SolidColorBrush(Color.FromArgb(255,0, 255, 255)); } Image myImage3 = new Image(); BitmapImage bi3 = new BitmapImage(); bi3.BeginInit(); bi3.UriSource = new Uri(x_Img[i].Value, UriKind.Relative); bi3.EndInit(); myImage3.Stretch = Stretch.Fill; myImage3.Source = bi3; f.path = path; f.func = x_Func[i].Value; f.img = myImage3; g[f.x, f.y] = f; } return(g); }
public void save(elm el, int X, int Y) { grid[X, Y, Convert.ToInt16(el.x), Convert.ToInt16(el.y)] = el; SolidColorBrush solid = (el.background as SolidColorBrush); string colorText = solid != null ? solid.Color.R + "," + solid.Color.G + "," + solid.Color.B : "255,0,0"; var doc = XDocument.Load(path); XElement target; try { target = doc.Elements("GridStatistique_Region_et_Pays").Elements("_" + X + "x" + Y).Elements("rec") .Where(e => (e.Element("X").Value == el.x.ToString()) & (e.Element("Y").Value == el.y.ToString())) .Single(); } catch { target = null; } if (target != null) { XNode[] d = target.Nodes().ToArray(); XElement id_ = (d[0] as XElement); XElement Date_upd_ = (d[1] as XElement); XElement X_ = (d[2] as XElement); XElement Y_ = (d[3] as XElement); XElement NameCountry_ = (d[4] as XElement); XElement background_ = (d[5] as XElement); XElement img_ = (d[6] as XElement); XElement font_ = (d[7] as XElement); XElement customerId_; if (d.Length > 8) { customerId_ = (d[8] as XElement); customerId_.Value = el.customerId.ToString(); } else { target.Add(new XElement("customerId", el.customerId)); } Date_upd_.Value = DateTime.Now.ToString(); NameCountry_.Value = el.NameCountry; background_.Value = colorText; // img_.Value = el.img; font_.Value = el.font; } else { XElement e = doc.Element("GridStatistique_Region_et_Pays").Element("_" + X + "x" + Y); if (e != null) { e.Add( new XElement("rec", new XElement("id", (el.x * el.y).ToString()), new XElement("Date_upd", DateTime.Now.ToString()), new XElement("X", el.x), new XElement("Y", el.y), new XElement("NameCountry", el.NameCountry), new XElement("background", colorText), new XElement("img", el.img), new XElement("font", el.font), new XElement("customerId", el.customerId) )) ; } else { doc.Element("GridStatistique_Region_et_Pays").Add( new XElement("_" + X + "x" + Y, new XElement("rec", new XElement("id", (el.x * el.y).ToString()), new XElement("Date_upd", DateTime.Now.ToString()), new XElement("X", el.x), new XElement("Y", el.y), new XElement("NameCountry", el.NameCountry), new XElement("background", colorText), new XElement("img", el.img), new XElement("font", el.font), new XElement("customerId", el.customerId) ) ) ); } } doc.Save(path); }
public print(ClassSync.ClassCloseTicket.CloseTicketG G, List <ClassSync.ClassCloseTicket.CloseTicket> C) { DateTime dt = G.DateClose; string date = dt.ToShortDateString(); string time = dt.ToShortTimeString(); int X = 0; int Y = 134; int H = size; int W = 280; int sizeLine = 12; elm n = new elm(); n.rectangle = new Rectangle(X, Y, W, H); n.stringFormat.Alignment = StringAlignment.Center; n.stringFormat.LineAlignment = StringAlignment.Near; n.text = "Date : " + date + " - Heure : " + time; E.Add(n); Y += H; List <mTotal> M = new List <mTotal>(); List <List <mTva> > TotalCaseTVA = new List <List <mTva> >(); foreach (var e in C.OrderBy(l => l.NameTicket)) { elm nl1 = new elm(); nl1.font = new Font("Arial", 12, FontStyle.Bold); nl1.rectangle = new Rectangle(X, Y + 15, W, H); nl1.stringFormat.Alignment = StringAlignment.Center; nl1.text = e.NameTicket.ToUpper(); E.Add(nl1); Y += H + 15; elm nlzv = new elm(); nlzv.rectangle = new Rectangle(X, Y, 300, H); nlzv.text = "**********************************************************"; E.Add(nlzv); Y += H; elm nl2 = new elm(); nl2.rectangle = new Rectangle(X, Y - 10, W, H); nl2.stringFormat.Alignment = StringAlignment.Center; nl2.text = e.DateClose.ToShortDateString(); E.Add(nl2); Y += H; List <ClassCheck.localTypesPay> LTP = getTypePay(e); decimal sumMoney = LTP.Sum(l => l.value); foreach (var l in LTP) { elm eNamePay = new elm(); eNamePay.rectangle = new Rectangle(X, Y, 120, H); eNamePay.stringFormat.Alignment = StringAlignment.Near; eNamePay.text = l.type.Name; E.Add(eNamePay); elm eValTTC = new elm(); eValTTC.rectangle = new Rectangle(X + 120, Y, 80, H); eValTTC.stringFormat.Alignment = StringAlignment.Far; eValTTC.text = l.value.ToString("C"); E.Add(eValTTC); elm eProc = new elm(); eProc.rectangle = new Rectangle(X + 200, Y, 80, H); eProc.stringFormat.Alignment = StringAlignment.Far; eProc.text = (l.value / sumMoney).ToString("P"); E.Add(eProc); Y += H; } elm nl4 = new elm(); nl4.font = new Font("Arial", 9, FontStyle.Bold); nl4.rectangle = new Rectangle(X, Y, 120, H); nl4.stringFormat.Alignment = StringAlignment.Near; nl4.text = "TOTAL"; E.Add(nl4); elm nsumMoney = new elm(); nsumMoney.font = new Font("Arial", 9, FontStyle.Bold); nsumMoney.rectangle = new Rectangle(X + 120, Y, 80, H); nsumMoney.stringFormat.Alignment = StringAlignment.Far; nsumMoney.text = sumMoney.ToString("C"); E.Add(nsumMoney); elm nsumProc = new elm(); nsumProc.font = new Font("Arial", 9, FontStyle.Bold); nsumProc.rectangle = new Rectangle(X + 200, Y, 80, H); nsumProc.stringFormat.Alignment = StringAlignment.Far; nsumProc.text = 1.ToString("P"); E.Add(nsumProc); Y += H; elm TiTVA = new elm(); TiTVA.font = new Font("Arial", 10, FontStyle.Bold); TiTVA.rectangle = new Rectangle(X, Y + 10, W, H); TiTVA.stringFormat.Alignment = StringAlignment.Center; TiTVA.text = "*** TVA ***"; E.Add(TiTVA); Y += H + 10; elm nl5 = new elm(); nl5.font = new Font("Arial", 9); nl5.rectangle = new Rectangle(X, Y, W, H); nl5.stringFormat.Alignment = StringAlignment.Near; nl5.stringFormat.LineAlignment = StringAlignment.Near; nl5.text = " TAUX HT TVA TTC"; E.Add(nl5); Y += H; decimal HT = 0.0m; decimal TVA = 0.0m; decimal TTC = 0.0m; List <mTva> CaseTva = getTVA(e); TotalCaseTVA.Add(CaseTva); foreach (mTva m in CaseTva) { elm eNameTVA = new elm(); eNameTVA.rectangle = new Rectangle(X, Y, 45, sizeLine); eNameTVA.stringFormat.Alignment = StringAlignment.Far; eNameTVA.stringFormat.LineAlignment = StringAlignment.Near; eNameTVA.text = m.tva.val + "%"; E.Add(eNameTVA); elm eHT = new elm(); eHT.rectangle = new Rectangle(X + 50, Y, 80, sizeLine); eHT.stringFormat.Alignment = StringAlignment.Far; eHT.stringFormat.LineAlignment = StringAlignment.Near; eHT.text = m.HT.ToString("C"); E.Add(eHT); elm eTVA = new elm(); eTVA.rectangle = new Rectangle(X + 130, Y, 70, sizeLine); eTVA.stringFormat.Alignment = StringAlignment.Far; eTVA.stringFormat.LineAlignment = StringAlignment.Near; eTVA.text = m.TVA.ToString("C"); E.Add(eTVA); elm eTTC = new elm(); eTTC.rectangle = new Rectangle(X + 200, Y, 80, sizeLine); eTTC.stringFormat.Alignment = StringAlignment.Far; eTTC.stringFormat.LineAlignment = StringAlignment.Near; eTTC.text = m.TTC.ToString("C"); E.Add(eTTC); Y += H; HT += m.HT; TVA += m.TVA; TTC += m.TTC; } elm eTotal = new elm(); eTotal.font = new Font("Arial", 9, FontStyle.Bold); eTotal.rectangle = new Rectangle(X, Y, 50, sizeLine); eTotal.stringFormat.Alignment = StringAlignment.Near; eTotal.stringFormat.LineAlignment = StringAlignment.Near; eTotal.text = "TOTAL"; E.Add(eTotal); elm eTht = new elm(); eTht.font = new Font("Arial", 9, FontStyle.Bold); eTht.rectangle = new Rectangle(X + 50, Y, 80, sizeLine); eTht.stringFormat.Alignment = StringAlignment.Far; eTht.stringFormat.LineAlignment = StringAlignment.Near; eTht.text = HT.ToString("C"); E.Add(eTht); elm eTTVA = new elm(); eTTVA.font = new Font("Arial", 9, FontStyle.Bold); eTTVA.rectangle = new Rectangle(X + 130, Y, 70, sizeLine); eTTVA.stringFormat.Alignment = StringAlignment.Far; eTTVA.stringFormat.LineAlignment = StringAlignment.Near; eTTVA.text = TVA.ToString("C"); E.Add(eTTVA); elm eTTTC = new elm(); eTTTC.font = new Font("Arial", 9, FontStyle.Bold); eTTTC.rectangle = new Rectangle(X + 200, Y, 80, sizeLine); eTTTC.stringFormat.Alignment = StringAlignment.Far; eTTTC.stringFormat.LineAlignment = StringAlignment.Near; eTTTC.text = TTC.ToString("C"); E.Add(eTTTC); Y += H; mTotal mt = new mTotal(); mt.count = decimal.ToInt32(e.ChecksTicket.Sum(l => l.PayProducts.Sum(la => la.QTY))); mt.sr_total = mt.count != 0 ? TTC / mt.count : 0; mt.name = e.NameTicket; mt.total = sumMoney; M.Add(mt); } if (C.Count > 1) { elm TGLOB = new elm(); TGLOB.font = new Font("Arial", 12, FontStyle.Bold); TGLOB.rectangle = new Rectangle(X, Y + 15, W, H); TGLOB.stringFormat.Alignment = StringAlignment.Center; TGLOB.stringFormat.LineAlignment = StringAlignment.Near; TGLOB.text = "TOTAL GLOBAL"; E.Add(TGLOB); Y += H + 15; elm nlzvzz = new elm(); nlzvzz.rectangle = new Rectangle(X, Y, 300, H); nlzvzz.text = "**********************************************************"; E.Add(nlzvzz); Y += H; List <ClassCheck.localTypesPay> LTPG = getTypePay(G); decimal sumMoneyG = LTPG.Sum(l => l.value); foreach (var l in LTPG) { elm eNamePay = new elm(); eNamePay.rectangle = new Rectangle(X, Y, 120, H); eNamePay.stringFormat.Alignment = StringAlignment.Near; eNamePay.text = l.type.Name; E.Add(eNamePay); elm eValTTC = new elm(); eValTTC.rectangle = new Rectangle(X + 120, Y, 80, H); eValTTC.stringFormat.Alignment = StringAlignment.Far; eValTTC.text = l.value.ToString("C"); E.Add(eValTTC); elm eProc = new elm(); eProc.rectangle = new Rectangle(X + 200, Y, 80, H); eProc.stringFormat.Alignment = StringAlignment.Far; eProc.text = (l.value / sumMoneyG).ToString("P"); E.Add(eProc); Y += H; } elm nl4 = new elm(); nl4.font = new Font("Arial", 9, FontStyle.Bold); nl4.rectangle = new Rectangle(X, Y, 120, H); nl4.stringFormat.Alignment = StringAlignment.Near; nl4.text = "TOTAL"; E.Add(nl4); elm nsumMoney = new elm(); nsumMoney.font = new Font("Arial", 9, FontStyle.Bold); nsumMoney.rectangle = new Rectangle(X + 120, Y, 80, H); nsumMoney.stringFormat.Alignment = StringAlignment.Far; nsumMoney.text = sumMoneyG.ToString("C"); E.Add(nsumMoney); elm nProc100 = new elm(); nProc100.font = new Font("Arial", 9, FontStyle.Bold); nProc100.rectangle = new Rectangle(X + 200, Y, 80, H); nProc100.stringFormat.Alignment = StringAlignment.Far; nProc100.text = 1.ToString("P"); E.Add(nProc100); Y += H; decimal GHT = 0.0m; decimal GTVA = 0.0m; decimal GTTC = 0.0m; List <mTva> tvaS = new List <mTva>(); foreach (List <mTva> m in TotalCaseTVA) { foreach (mTva ntva in m) { int indx = tvaS.FindIndex(l => l.tva == ntva.tva); if (indx == -1) { mTva j = new mTva(); j.HT = ntva.HT; j.TTC = ntva.TTC; j.tva = ntva.tva; j.TVA = ntva.TVA; tvaS.Add(j); } else { tvaS[indx].HT += ntva.HT; tvaS[indx].TTC += ntva.TTC; tvaS[indx].TVA += ntva.TVA; } } } elm TiTVA = new elm(); TiTVA.font = new Font("Arial", 10, FontStyle.Bold); TiTVA.rectangle = new Rectangle(X, Y + 10, W, H); TiTVA.stringFormat.Alignment = StringAlignment.Center; TiTVA.text = "*** TVA ***"; E.Add(TiTVA); Y += H + 10; elm nl5hed = new elm(); nl5hed.font = new Font("Arial", 9); nl5hed.rectangle = new Rectangle(X, Y, W, H); nl5hed.stringFormat.Alignment = StringAlignment.Near; nl5hed.stringFormat.LineAlignment = StringAlignment.Near; nl5hed.text = " TAUX HT TVA TTC"; E.Add(nl5hed); Y += H; foreach (mTva m in tvaS) { elm eNameTVA = new elm(); eNameTVA.rectangle = new Rectangle(X, Y, 45, sizeLine); eNameTVA.stringFormat.Alignment = StringAlignment.Far; eNameTVA.stringFormat.LineAlignment = StringAlignment.Near; eNameTVA.text = m.tva.val + "%"; E.Add(eNameTVA); elm eHT = new elm(); eHT.rectangle = new Rectangle(X + 50, Y, 80, sizeLine); eHT.stringFormat.Alignment = StringAlignment.Far; eHT.stringFormat.LineAlignment = StringAlignment.Near; eHT.text = m.HT.ToString("C"); E.Add(eHT); elm eTVA = new elm(); eTVA.rectangle = new Rectangle(X + 130, Y, 70, sizeLine); eTVA.stringFormat.Alignment = StringAlignment.Far; eTVA.stringFormat.LineAlignment = StringAlignment.Near; eTVA.text = m.TVA.ToString("C"); E.Add(eTVA); elm eTTC = new elm(); eTTC.rectangle = new Rectangle(X + 200, Y, 80, sizeLine); eTTC.stringFormat.Alignment = StringAlignment.Far; eTTC.stringFormat.LineAlignment = StringAlignment.Near; eTTC.text = m.TTC.ToString("C"); E.Add(eTTC); Y += H; GHT += m.HT; GTVA += m.TVA; GTTC += m.TTC; } elm eTotal = new elm(); eTotal.font = new Font("Arial", 9, FontStyle.Bold); eTotal.rectangle = new Rectangle(X, Y, 50, sizeLine); eTotal.stringFormat.Alignment = StringAlignment.Near; eTotal.stringFormat.LineAlignment = StringAlignment.Near; eTotal.text = "TOTAL"; E.Add(eTotal); elm eTht = new elm(); eTht.font = new Font("Arial", 9, FontStyle.Bold); eTht.rectangle = new Rectangle(X + 50, Y, 80, sizeLine); eTht.stringFormat.Alignment = StringAlignment.Far; eTht.stringFormat.LineAlignment = StringAlignment.Near; eTht.text = GHT.ToString("C"); E.Add(eTht); elm eTTVA = new elm(); eTTVA.font = new Font("Arial", 9, FontStyle.Bold); eTTVA.rectangle = new Rectangle(X + 130, Y, 70, sizeLine); eTTVA.stringFormat.Alignment = StringAlignment.Far; eTTVA.stringFormat.LineAlignment = StringAlignment.Near; eTTVA.text = GTVA.ToString("C"); E.Add(eTTVA); elm eTTTC = new elm(); eTTTC.font = new Font("Arial", 9, FontStyle.Bold); eTTTC.rectangle = new Rectangle(X + 200, Y, 80, sizeLine); eTTTC.stringFormat.Alignment = StringAlignment.Far; eTTTC.stringFormat.LineAlignment = StringAlignment.Near; eTTTC.text = GTTC.ToString("C"); E.Add(eTTTC); } elm TSTAT = new elm(); TSTAT.font = new Font("Arial", 12, FontStyle.Bold); TSTAT.rectangle = new Rectangle(X, Y + 15, W, H); TSTAT.stringFormat.Alignment = StringAlignment.Center; TSTAT.stringFormat.LineAlignment = StringAlignment.Near; TSTAT.text = "STATISTIQUES"; E.Add(TSTAT); Y += H + 15; elm nlzvz = new elm(); nlzvz.rectangle = new Rectangle(X, Y, 300, H); nlzvz.text = "**********************************************************"; E.Add(nlzvz); Y += H; elm nl8 = new elm(); nl8.font = new Font("Arial", 9); nl8.rectangle = new Rectangle(X, Y, W, H); nl8.stringFormat.Alignment = StringAlignment.Near; nl8.stringFormat.LineAlignment = StringAlignment.Near; nl8.text = "Description QTY Moyen %"; E.Add(nl8); Y += H; decimal sumM = M.Sum(l => l.total); foreach (mTotal m in M) { elm nl9 = new elm(); nl9.rectangle = new Rectangle(X, Y, 60, H); nl9.stringFormat.Alignment = StringAlignment.Near; nl9.text = m.name; E.Add(nl9); elm nlcount = new elm(); nlcount.rectangle = new Rectangle(X + 60, Y, 80, H); nlcount.stringFormat.Alignment = StringAlignment.Far; nlcount.text = m.count.ToString(); E.Add(nlcount); elm nlctt = new elm(); nlctt.rectangle = new Rectangle(X + 140, Y, 70, H); nlctt.stringFormat.Alignment = StringAlignment.Far; nlctt.text = m.sr_total.ToString("C"); E.Add(nlctt); elm nlsrd = new elm(); nlsrd.rectangle = new Rectangle(X + 210, Y, 70, H); nlsrd.stringFormat.Alignment = StringAlignment.Far; nlsrd.text = (sumM == 0 ? 0 : (m.total / sumM)).ToString("P"); E.Add(nlsrd); Y += H; } if (C.Count > 0) { elm nl10 = new elm(); nl10.rectangle = new Rectangle(X, Y, 60, H); nl10.stringFormat.Alignment = StringAlignment.Near; nl10.text = "TOTAL"; E.Add(nl10); elm nl10Tot = new elm(); nl10Tot.rectangle = new Rectangle(X + 60, Y, 80, H); nl10Tot.stringFormat.Alignment = StringAlignment.Far; nl10Tot.text = M.Sum(l => l.count).ToString(); E.Add(nl10Tot); elm nl10mSum = new elm(); nl10mSum.rectangle = new Rectangle(X + 140, Y, 70, H); nl10mSum.stringFormat.Alignment = StringAlignment.Far; nl10mSum.text = Math.Round(M.Sum(l => l.sr_total), 2).ToString("C"); E.Add(nl10mSum); elm nl10_100 = new elm(); nl10_100.rectangle = new Rectangle(X + 210, Y, 70, H); nl10_100.stringFormat.Alignment = StringAlignment.Far; nl10_100.text = 1.ToString("P"); E.Add(nl10_100); Y += H; } Y += H + 20; }
internal elmFinder(wnd w, elm e) { _wnd = w; _elm = e; _flags = _EFFlags_Empty; }
public Cpp_Acc(elm e) { acc = e._iacc; elem = e._elem; misc = e._misc; }
private void load(string path) { XDocument xmlGrid = XDocument.Load(path); for (int I = 0; I < 12; I++) { for (int J = 0; J < 12; J++) { List <XElement> x_elms = (from el in xmlGrid.Elements("GridProduct").Elements("_" + I + "x" + J).Elements("rec") select el).ToList(); elm[] e = new elm[x_elms.Count]; foreach (XElement x in x_elms) { elm f = new elm(); f.x = byte.Parse(x.Element("X").Value); f.y = byte.Parse(x.Element("Y").Value); f.Description = x.Element("Description").Value; string[] rgbt; string[] rgbt_f; try { rgbt_f = x.Element("font").Value.Split(','); if (rgbt_f.Length == 3) { f.font = new SolidColorBrush(Color.FromRgb(byte.Parse(rgbt_f[0]), byte.Parse(rgbt_f[1]), byte.Parse(rgbt_f[2]))); } else { f.font = new SolidColorBrush(Color.FromRgb(0, 0, 0)); } } catch { f.font = new SolidColorBrush(Color.FromRgb(0, 0, 0)); } try { rgbt = x.Element("background").Value.Split(','); if (rgbt.Length == 3) { f.background = new SolidColorBrush(Color.FromRgb(byte.Parse(rgbt[0]), byte.Parse(rgbt[1]), byte.Parse(rgbt[2]))); } else { f.background = new SolidColorBrush(Color.FromRgb(0, 255, 255)); } } catch { f.background = new SolidColorBrush(Color.FromRgb(0, 255, 255)); } f.customerId = x.Element("customerId") != null? Guid.Parse(x.Element("customerId").Value) : Guid.Empty; if (f.customerId == Guid.Empty) { new ClassLog(f.Description); } grid[I, J, f.x, f.y] = f; } } } }