public override void decode() { entries = new List<PLUReportEntry>(); List<List<byte>> report = ECRComms.chunk(data.ToList(), 0x26); double totalamount = 0; Console.WriteLine("\n\n ****************************** "); Console.WriteLine("STOCK REPORT\n\n"); foreach (List<byte> lb in report) { double qty = ECRComms.extractfloat4(lb.ToArray(), 0x1b); //Int32 iqty = (lb[0x1e] << 24) + (lb[0x1d] << 16) + (lb[0x1c] << 8) + lb[0x1b]; //double qty = iqty / 100.0; //its not really an int its a 2 dp float if (qty == 0) continue; PLUReportEntry entry = new PLUReportEntry(); entry.quantity = qty; for (int pos = 1; pos < 19; pos++) { char c = (char)lb[pos]; if ((c > 31) && (c < 127)) { //Console.Write(String.Format("{0}", c)); entry.Description += c; } } barcode b = new barcode(); Buffer.BlockCopy(lb.ToArray(), 0x13, b.data, 0, barcode.Length); b.decode(); entry.PLU = b; double xx = ECRComms.extractfloat3(lb.ToArray(), 0x23); entry.value = xx; totalamount += (xx); entries.Add(entry); Console.WriteLine(entry.ToString()); } //Console.WriteLine("\n\n**************************************"); //Console.WriteLine(String.Format("Total for today {0} \n\n", totalamount)); total = totalamount; }
public PLUReport(bool simulation) { if (simulation == true) { Console.WriteLine("PLU report simulation==true"); entries = new List<PLUReportEntry>(); PLUReportEntry entry = new PLUReportEntry(); entry.PLU = new barcode(); entry.PLU.fromtext("5025572020824"); entry.quantity = 1; entry.value = 5.99; entry.Description = "TEST PRODUCT 2"; entries.Add(entry); total = 5.99; } }