public void SetOrder(SuposDataSet.OrdersRow order) { Supos.Core.SuposDb.OrderTotal tot = SuposDb.GetOrderTotal(order); this.entryprice.Text = tot.TotPrice.ToString(); this.entrytax.Text = tot.TaxAmount.ToString(); this.entryttcprice.Text = tot.TotPriceTaxInc.ToString(); }
public SuposDataSet.OrderDetailsRow AddProductInOrder(SuposDataSet.OrdersRow order, SuposDataSet.ProductsRow product) { if( order==null || product==null) return null; //TODO: Handle error SuposDataSet.OrderDetailsRow row = (SuposDataSet.OrderDetailsRow)ds.OrderDetails.NewRow(); row.Id = Util.GetIdStringNow(); row.OrderId = order.Id; row.ProductId = product.Id; row.TaxId = product.DefaultTaxId; row.Quantity = 1; row.Price = product.Price; ds.OrderDetails.AddOrderDetailsRow(row); return row; }
public void SetDataFromOrder( SuposDataSet.OrdersRow order) { if( order == null) return; entryid.Text = order.Id; combocust.SelectFromId( order.CustomerId.ToString() ); // if( order["PaymentId"] != System.DBNull.Value ) combopay.SelectFromId( order["PaymentId"].ToString() ); // else // combopay.SelectFirst(); // if( order["TaxId"] != System.DBNull.Value ) combotax.SelectFromId( order["TaxId"].ToString() ); // else // combotax.SelectFirst(); }
static public OrderTotal GetOrderTotal( SuposDataSet.OrdersRow order) { OrderTotal result = new OrderTotal(); if (order != null) { SuposDataSet.OrderDetailsRow[] details = (SuposDataSet.OrderDetailsRow[])order.GetChildRows( "FK_orders_OrderDetails" ); result.TotPrice = 0; result.TaxAmount = 0; foreach( SuposDataSet.OrderDetailsRow detail in details) { result.TotPrice += detail.Price*detail.Quantity; result.TaxAmount += (Decimal)detail.TaxesRow.Rate * detail.Price; } } return result; }
public bool AddOrder(SuposDataSet.OrdersRow order) { ds.Orders.AddOrdersRow(order); return true; }
public SuposDb( DbSettings config ) { settings = config; ds = new SuposDataSet(); provider = new SuposDbProvider(config); }
public void SelectDetail( SuposDataSet.OrderDetailsRow detail) { view.Select(detail); }
public void SetDataFromOrderDetail( SuposDataSet.OrderDetailsRow detail) { if( detail == null) return; combotax.SelectFromId( detail.TaxId.ToString() ); spinprice.Value = (double)detail.Price; spinquant.Value = (double)detail.Quantity; }
public void Fill(SuposDataSet ds) { CategoriesAdapter.Fill(ds); Util.SetAutoincrementSeed( ds.Categories, "Id"); TaxesAdapter.Fill(ds); Util.SetAutoincrementSeed( ds.Taxes, "Id"); ProductsAdapter.Fill(ds); Util.SetAutoincrementSeed( ds.Products, "Id"); CustomersAdapter.Fill(ds); Util.SetAutoincrementSeed( ds.Customers, "Id"); PaymentsAdapter.Fill(ds); Util.SetAutoincrementSeed( ds.Payments, "Id"); OrdersAdapter.Fill(ds); OrderDetailsAdapter.Fill(ds); MetaAdapter.Fill(ds); Util.SetAutoincrementSeed( ds.Meta, "Id"); }