Ejemplo n.º 1
0
 private static bool ShouldAutoPrint(Ticket ticket, PrintJob customPrinter)
 {
     if (customPrinter.WhenToPrint == (int)WhenToPrintTypes.Manual) return false;
     if (customPrinter.WhenToPrint == (int)WhenToPrintTypes.Paid)
     {
         if (ticket.DidPrintJobExecuted(customPrinter.Id)) return false;
         if (!ticket.IsPaid) return false;
         if (!customPrinter.AutoPrintIfCash && !customPrinter.AutoPrintIfCreditCard && !customPrinter.AutoPrintIfTicket) return false;
         if (customPrinter.AutoPrintIfCash && ticket.Payments.Count(x => x.PaymentType == (int)PaymentType.Cash) > 0) return true;
         if (customPrinter.AutoPrintIfCreditCard && ticket.Payments.Count(x => x.PaymentType == (int)PaymentType.CreditCard) > 0) return true;
         if (customPrinter.AutoPrintIfTicket && ticket.Payments.Count(x => x.PaymentType == (int)PaymentType.Ticket) > 0) return true;
     }
     if (customPrinter.WhenToPrint == (int)WhenToPrintTypes.NewLinesAdded && ticket.GetUnlockedLines().Count() > 0) return true;
     return false;
 }