public SalePaymentViewModel(SaleHeader sale)
     : base(new SalePaymentView())
 {
     this.sale = sale;
     sale.SalePaymentHeader = new SalePaymentHeader(sale.TerminalToCode);
     ViewHeader = Resources.FinalCustomer;
     CustomerSelectionCommand.Executed += CustomerSelectionCommandExecuted;
 }
Exemplo n.º 2
0
 public static void PrintSale(SaleHeader header)
 {
     if (header.PrintMode == 0)
     {
         //TerminalPrinters.Instance.TextOnlyPrinter.Open();
         TerminalPrinters.Instance.TextOnlyPrinter.Clear();
         TerminalPrinters.Instance.TextOnlyPrinter.AppendLine(string.Format("Fecha: {0}   Hora: {1}", DateTime.Now.Date.ToString("dd/MM/yy"), DateTime.Now.ToString("hh:mm:ss")));
         TerminalPrinters.Instance.TextOnlyPrinter.AppendColumnsLine("Descripcion    ", "Cant.   ", "P.Unit.  ", "Precio");
         TerminalPrinters.Instance.TextOnlyPrinter.AppendLine("=", '=');
         foreach (var saleItem in header.SaleItems)
         {
             TerminalPrinters.Instance.TextOnlyPrinter.AppendLine(saleItem.Product.Name);
             TerminalPrinters.Instance.TextOnlyPrinter.AppendColumnsLine("", saleItem.Quantity.ToString("0.00"), saleItem.Product.Price1.Value.ToString("0.00"), saleItem.PriceValue.ToString("0.00"));
         }
         TerminalPrinters.Instance.TextOnlyPrinter.AppendLine("=", '=');
         TerminalPrinters.Instance.TextOnlyPrinter.AppendLine();
         TerminalPrinters.Instance.TextOnlyPrinter.AppendLine(string.Format("Total: ${0}", header.PriceSumValue));
         TerminalPrinters.Instance.TextOnlyPrinter.AppendLine();
         TerminalPrinters.Instance.TextOnlyPrinter.AppendLine("Gracias por su compra");
         TerminalPrinters.Instance.TextOnlyPrinter.Print();
         //TerminalPrinters.Instance.TextOnlyPrinter.Close();
     }
     else
     {
         if (TerminalPrinters.Instance.LegalPrinter != null && TerminalPrinters.Instance.LegalPrinter.IsOnLine)
         {
             TerminalPrinters.Instance.LegalPrinter.Clear();
             TerminalPrinters.Instance.LegalPrinter.OpenInvoice(null);
             if (!TerminalPrinters.Instance.LegalPrinter.HasError)
             {
                 foreach (var saleItem in header.SaleItems)
                 {
                     if (!TerminalPrinters.Instance.LegalPrinter.HasError)
                     {
                         TerminalPrinters.Instance.LegalPrinter.PrintItem(saleItem.Product.Name, 1, saleItem.PriceValue, saleItem.Product.Tax.Value, 0);
                     }
                 }
                 if (!TerminalPrinters.Instance.LegalPrinter.HasError)
                 {
                     TerminalPrinters.Instance.LegalPrinter.Print();
                 }
             }
         }
     }
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the SaleHeaders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSaleHeaders(SaleHeader saleHeader)
 {
     base.AddObject("SaleHeaders", saleHeader);
 }
 /// <summary>
 /// Create a new SaleHeader object.
 /// </summary>
 /// <param name="terminalCode">Initial value of the TerminalCode property.</param>
 /// <param name="code">Initial value of the Code property.</param>
 /// <param name="terminalToCode">Initial value of the TerminalToCode property.</param>
 /// <param name="date">Initial value of the Date property.</param>
 /// <param name="saleTypeCode">Initial value of the SaleTypeCode property.</param>
 /// <param name="payIsComplete">Initial value of the PayIsComplete property.</param>
 /// <param name="priceSumValue">Initial value of the PriceSumValue property.</param>
 /// <param name="taxSumValue">Initial value of the TaxSumValue property.</param>
 /// <param name="tax1SumValue">Initial value of the Tax1SumValue property.</param>
 /// <param name="summarized">Initial value of the Summarized property.</param>
 /// <param name="historized">Initial value of the Historized property.</param>
 public static SaleHeader CreateSaleHeader(global::System.Int32 terminalCode, global::System.Int32 code, global::System.Int32 terminalToCode, global::System.DateTime date, global::System.Int32 saleTypeCode, global::System.Boolean payIsComplete, global::System.Double priceSumValue, global::System.Double taxSumValue, global::System.Double tax1SumValue, global::System.Boolean summarized, global::System.Boolean historized)
 {
     SaleHeader saleHeader = new SaleHeader();
     saleHeader.TerminalCode = terminalCode;
     saleHeader.Code = code;
     saleHeader.TerminalToCode = terminalToCode;
     saleHeader.Date = date;
     saleHeader.SaleTypeCode = saleTypeCode;
     saleHeader.PayIsComplete = payIsComplete;
     saleHeader.PriceSumValue = priceSumValue;
     saleHeader.TaxSumValue = taxSumValue;
     saleHeader.Tax1SumValue = tax1SumValue;
     saleHeader.Summarized = summarized;
     saleHeader.Historized = historized;
     return saleHeader;
 }
 public SaleReportItemViewModel(SaleHeader saleHeader)
     : base(new SaleReportItemView())
 {
     SaleHeader = saleHeader;
 }
 public PaymentInstrumentSelectionViewModel(SaleHeader saleHeader)
     : base(new PaymentInstrumentSelection())
 {
     currentSale = saleHeader;
     SelectedQuantity = saleHeader.SalePaymentHeader.RestToPay;
 }