Exemplo n.º 1
0
		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();
		}
Exemplo n.º 2
0
		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;
		}
Exemplo n.º 3
0
		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();
		}
Exemplo n.º 4
0
		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;
		}
Exemplo n.º 5
0
		public bool AddOrder(SuposDataSet.OrdersRow order)
		{
			ds.Orders.AddOrdersRow(order);		
			return true;
		}
Exemplo n.º 6
0
		public SuposDb( DbSettings config )
		{ 
			settings = config;
			ds = new SuposDataSet();
			provider = new SuposDbProvider(config);
		}
Exemplo n.º 7
0
		public void SelectDetail( SuposDataSet.OrderDetailsRow detail)
		{
			view.Select(detail);
		}
Exemplo n.º 8
0
		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;
		}
Exemplo n.º 9
0
		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");
		}