public Spec(InvoiceSpec ispec, Table table, uint row) { description = new Entry(); number = new Entry(); price = new Entry(); total = new Entry(); number.Changed += new EventHandler(UpdateTotal); price.Changed += new EventHandler(UpdateTotal); total.Changed += new EventHandler(TotalChanged); number.SetUsize(NumberEntryWidth, -2); price.SetUsize(NumberEntryWidth, -2); total.SetUsize(NumberEntryWidth, -2); description.SetUsize(300, -2); table.Attach(description, 0, 1, row, row+1, AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0); table.Attach(number, 1, 2, row, row+1, 0, 0, 0, 0); table.Attach(price, 2, 3, row, row+1, 0, 0, 0, 0); table.Attach(total, 3, 4, row, row+1, 0, 0, 0, 0); description.Text = ispec.beskrivning; if (ispec.antal.Length > 0) number.Text = ispec.antal; price.Text = ispec.styckpris; total.Text = ispec.belopp; }
public Invoice(string nr) { namn = ""; address = ""; postnr = ""; postort = ""; referens = ""; fakturanr = nr; antaldgr = "30"; DateTime now = DateTime.Now; datum = String.Format("{0:0000}-{1:00}-{2:00}", now.Year, now.Month, now.Day); specs = new InvoiceSpec[15]; for (int i=0; i<15; i++) specs[i] = new InvoiceSpec(); }
public void load(string path) { FileStream stream = new System.IO.FileStream(path, FileMode.Open, FileAccess.Read); namn = Unmangle(ReadLine(stream)); bool version2 = ((namn == "||VERSION2||") || (namn == "||VERSION3||")); if (version2) namn = Unmangle(ReadLine(stream)); address = Unmangle(ReadLine(stream)); postnr = Unmangle(ReadLine(stream)); postort = Unmangle(ReadLine(stream)); referens = Unmangle(ReadLine(stream)); datum = Unmangle(ReadLine(stream)); fakturanr = Unmangle(ReadLine(stream)); if (version2) antaldgr = Unmangle(ReadLine(stream)); specs = new InvoiceSpec[15]; for (int i=0; i<15; i++) { string line = ReadLine(stream); string[] elems = line.Split('\t'); if (elems.Length != 4) throw new FileFormatException(); specs[i] = new InvoiceSpec(Unmangle(elems[0]), Unmangle(elems[1]), Unmangle(elems[2]), Unmangle(elems[3])); } stream.Close(); }