示例#1
0
		private void LoadOptions()
		{
			Contacts clsContact = new Contacts();
			cboContact.DataTextField = "ContactName";
			cboContact.DataValueField = "ContactID";
            cboContact.DataSource = clsContact.SuppliersAsDataTable(txtContactCode.Text).DefaultView;
			cboContact.DataBind();
            cboContact.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
			cboContact.SelectedIndex = 0;

            ProductGroup clsProductGroup = new ProductGroup(clsContact.Connection, clsContact.Transaction);
			cboProductGroup.DataTextField = "ProductGroupName";
			cboProductGroup.DataValueField = "ProductGroupID";
            cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(txtProductGroupCode.Text, "ProductGroupName").DefaultView;
			cboProductGroup.DataBind();
			cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
			cboProductGroup.SelectedIndex = 0;

            clsContact.CommitAndDispose();

			cboProductGroup_SelectedIndexChanged(null, System.EventArgs.Empty);

            txtPromoBySupplierValue.Text = "0";

            txtCouponRemarks.Text =  "{DateNow}: Congratulations you qualified for our annual raffle promo brought to you by HOUSEWARE PLAZA SUPERSTORE and {SupplierName}.";
            txtCouponRemarks.Text += Environment.NewLine + Environment.NewLine + "Please proceed to our customer service for more info.";
            txtCouponRemarks.Text += Environment.NewLine + Environment.NewLine + "Products: {ProductGroup}";
            txtCouponRemarks.Text += Environment.NewLine + Environment.NewLine + "Total Amount Puchased: {Amount}";
            txtCouponRemarks.Text += Environment.NewLine + "OR No: {ORNo}";
            txtCouponRemarks.Text += Environment.NewLine + "Customer Name: {CustomerName}";
            txtCouponRemarks.Text += Environment.NewLine + "Check Ctr: {CheckCounter}";
		}
        protected void Page_Load(object sender, System.EventArgs e)
		{
			if (!IsPostBack)
				if (Visible)
				{
                    Branch clsBranch = new Branch();
                    cboBranch.DataTextField = "BranchCode";
                    cboBranch.DataValueField = "BranchID";
                    cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
                    cboBranch.DataBind();
                    
                    cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));

                    mlngItemNo = 0;

                    ProductGroup clsProductGroup = new ProductGroup(clsBranch.Connection, clsBranch.Transaction);
                    cboProductGroup.DataTextField = "ProductGroupName";
                    cboProductGroup.DataValueField = "ProductGroupID";
                    cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(txtProductGroup.Text).DefaultView;
                    cboProductGroup.DataBind();
                    cboProductGroup.SelectedIndex = 0;

                    clsBranch.CommitAndDispose();

					LoadList();
				}
        }
示例#3
0
		private void LoadOptions()
		{
			Contacts clsContact = new Contacts();
			cboContact.DataTextField = "ContactName";
			cboContact.DataValueField = "ContactID";
            cboContact.DataSource = clsContact.CustomersDataTable(txtContactCode.Text).DefaultView;
			cboContact.DataBind();
            cboContact.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboContact.Items.Insert(1, new ListItem(Constants.PLUSCARDMEMBERS, Constants.PLUSCARDMEMBERSID_STRING));
            cboContact.Items.Insert(2, new ListItem(Constants.ICCARDMEMBERS, Constants.ICCARDMEMBERSID_STRING));
            cboContact.Items.Insert(3, new ListItem(Constants.GCCARDMEMBERS, Constants.GCCARDMEMBERSID_STRING));
			cboContact.SelectedIndex = 0;

            ProductGroup clsProductGroup = new ProductGroup(clsContact.Connection, clsContact.Transaction);
			cboProductGroup.DataTextField = "ProductGroupName";
			cboProductGroup.DataValueField = "ProductGroupID";
            cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(txtProductGroupCode.Text, "ProductGroupName").DefaultView;
			cboProductGroup.DataBind();
			cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
			cboProductGroup.SelectedIndex = 0;

            clsContact.CommitAndDispose();

			cboProductGroup_SelectedIndexChanged(null, System.EventArgs.Empty);

            txtQuantity.Text = "1";
            txtPromoValue.Text = "0";
		}
        protected void Page_Load(object sender, System.EventArgs e)
		{
			if (!IsPostBack)
				if (Visible)
				{
                    Branch clsBranch = new Branch();
                    cboBranch.DataTextField = "BranchCode";
                    cboBranch.DataValueField = "BranchID";
                    cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
                    cboBranch.DataBind();
                    
                    cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));

                    mlngItemNo = 0;

                    ProductGroup clsProductGroup = new ProductGroup(clsBranch.Connection, clsBranch.Transaction);
                    cboProductGroup.DataTextField = "ProductGroupName";
                    cboProductGroup.DataValueField = "ProductGroupID";
                    cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(txtProductGroup.Text).DefaultView;
                    cboProductGroup.DataBind();
                    cboProductGroup.SelectedIndex = 0;

                    clsBranch.CommitAndDispose();

                    txtClosingDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
					ManageSecurity();
					LoadList();
                    cmdZeroOutActualQuantity.Attributes.Add("onClick", "return confirm_zeroout_inventory();");
                    imgZeroOutActualQuantity.Attributes.Add("onClick", "return confirm_zeroout_inventory();");
                    cmdCopyPOSToActual.Attributes.Add("onClick", "return confirm_copypostoactual_inventory();");
                    imgCopyPOSToActual.Attributes.Add("onClick", "return confirm_copypostoactual_inventory();");
                    //cmdCloseInventory.Attributes.Add("onClick", "return confirm_close_inventory();");
                    //imgCloseInventory.Attributes.Add("onClick", "return confirm_close_inventory();");
				}
        }
示例#5
0
		private void LoadOptions()
		{
			ProductGroup clsProductGroup = new ProductGroup();
			DataClass clsDataClass = new DataClass();
			
			cboGroup.DataTextField = "ProductGroupName";
			cboGroup.DataValueField = "ProductGroupID";
			cboGroup.DataSource = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName").DefaultView;
			cboGroup.DataBind();
			cboGroup.SelectedIndex = cboGroup.Items.Count - 1;

            Data.Unit clsUnit = new Data.Unit();
			
			cboProductSubGroupUnit.DataTextField = "UnitName";
			cboProductSubGroupUnit.DataValueField = "UnitID";
			cboProductSubGroupUnit.DataSource = clsUnit.ListAsDataTable(SortField: "UnitName").DefaultView;
			cboProductSubGroupUnit.DataBind();
			cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.Count - 1;

			clsUnit.CommitAndDispose();		
	
			if (cboGroup.Items.Count != 0)
			{
				Int32 BaseUnitID= clsProductGroup.Details(Convert.ToInt32(cboGroup.SelectedItem.Value)).UnitDetails.UnitID;
				cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.IndexOf( cboProductSubGroupUnit.Items.FindByValue(BaseUnitID.ToString()));
			}
			clsProductGroup.CommitAndDispose();	
		}
		private void LoadOptions()
		{
            ProductGroup clsProductGroup = new ProductGroup();
            cboGroup.DataTextField = "ProductGroupName";
            cboGroup.DataValueField = "ProductGroupID";
            cboGroup.DataSource = clsProductGroup.ListAsDataTable();
            cboGroup.DataBind();
            cboGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING));
            cboGroup.SelectedIndex = 0;

            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroup clsSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction);
            cboSubGroup.DataTextField = "ProductSubGroupName";
            cboSubGroup.DataValueField = "ProductSubGroupID";
            cboSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending);
            cboSubGroup.DataBind();
            cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING));
            cboSubGroup.SelectedIndex = 0;

            Contacts clsContact = new Contacts(clsProductGroup.Connection, clsProductGroup.Transaction);
            cboSupplier.DataTextField = "ContactName";
            cboSupplier.DataValueField = "ContactID";
            cboSupplier.DataSource = clsContact.SuppliersAsDataTable(string.Empty, 0, "ContactName", SortOption.Ascending);
            cboSupplier.DataBind();
            cboSupplier.Items.Add(new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboSupplier.SelectedIndex = cboSupplier.Items.Count - 1;

            clsProductGroup.CommitAndDispose();

            txtStartTransactionDate.Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
            txtEndTransactionDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
		}
示例#7
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
			const string defaultHeading = "Master Files";
			string stHeading = defaultHeading;			

			const string defaultTitle = "List of Product Group Variation Combinations";
			SiteTitle.Title = defaultTitle;

			const SearchCategoryID defaultSearchIndex = SearchCategoryID.ProductGroupVariations;
			SearchCategoryID SearchIndex = defaultSearchIndex;			

			HorizontalNavBar.PageNavigatorid = HorizontalNavID.MasterFiles;
			
			if (Request.QueryString["task"]!=null)
			{
                ProductGroup clsProductGroup = new ProductGroup();
                ProductGroupDetails clsDetails = new ProductGroupDetails();

                long id = Convert.ToInt64(Common.Decrypt(Request.QueryString["groupid"].ToString(), Session.SessionID));
                clsDetails = clsProductGroup.Details(id);

                clsProductGroup.CommitAndDispose();

                string groupCode = " for Product Group Code : " + clsDetails.ProductGroupName;

				string task = Common.Decrypt(Request.QueryString["task"].ToString(),Session.SessionID);
				switch(task)
				{
					case "add":
						stHeading = "Create New Product Group Variation Combination";	
						SearchIndex = SearchCategoryID.ProductGroupVariationsMatrix;
						ctrlInsert.Visible = true;
						break;
					case "edit":
						stHeading = "Modify Product Group Variation Combination";
						SearchIndex = SearchCategoryID.ProductGroupVariationsMatrix;
						ctrlUpdate.Visible = true;
						break;   
					case "list":
						stHeading = "Product Group Variation Combinations List";		
						SearchIndex = SearchCategoryID.ProductGroupVariationsMatrix;
						ctrlList.Visible = true;
						break;
                    case "details":
                        stHeading = "Product Group Variation Combination details";
                        SearchIndex = SearchCategoryID.ProductGroupVariationsMatrix;
                        ctrlDetails.Visible = true;
                        break;  
					default:	
						break;
				}

				LargeHeading.Text = stHeading + groupCode;
				RightBodySectionSearch.SearchIDSelectedItem = SearchIndex;
			}
		}
示例#8
0
		protected void cboGroup_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if (cboGroup.Items.Count != 0)
			{
				ProductGroup clsProductGroup = new ProductGroup();
				Int32 BaseUnitID= clsProductGroup.Details(Convert.ToInt32(cboGroup.SelectedItem.Value)).UnitDetails.UnitID;
				cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.IndexOf( cboProductSubGroupUnit.Items.FindByValue(BaseUnitID.ToString()));
				clsProductGroup.CommitAndDispose();	
			}
		}
 protected void imgProductGroupSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e)
 {
     ProductGroup clsProductGroup = new ProductGroup();
     cboProductGroup.DataTextField = "ProductGroupName";
     cboProductGroup.DataValueField = "ProductGroupID";
     cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(txtProductGroup.Text).DefaultView;
     cboProductGroup.DataBind();
     cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
     if (cboProductGroup.Items.Count > 1 && txtProductGroup.Text.Trim() != string.Empty) cboProductGroup.SelectedIndex = 1; else cboProductGroup.SelectedIndex = 0;
     clsProductGroup.CommitAndDispose();
 }
示例#10
0
        private void LoadOptionsProducts()
        {
            ProductGroup clsProductGroup = new ProductGroup();
            cboGroup.DataTextField = "ProductGroupName";
            cboGroup.DataValueField = "ProductGroupID";
            cboGroup.DataSource = clsProductGroup.ListAsDataTable();
            cboGroup.DataBind();
            cboGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING));
            cboGroup.SelectedIndex = 0;
            clsProductGroup.CommitAndDispose();

            cboGroup_SelectedIndexChanged(null, null);
        }
示例#11
0
		protected void cboGroup_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if (cboGroup.Items.Count != 0)
			{
				ProductGroup clsProductGroup = new ProductGroup();
				ProductGroupDetails clsProductGroupDetails = clsProductGroup.Details(Convert.ToInt32(cboGroup.SelectedItem.Value));
				cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.IndexOf( cboProductSubGroupUnit.Items.FindByValue(clsProductGroupDetails.UnitDetails.UnitID.ToString()));
				txtProductPrice.Text = clsProductGroupDetails.Price.ToString("#,##0.#0");
				txtPurchasePrice.Text = clsProductGroupDetails.PurchasePrice.ToString("#,##0.#0");
                chkIncludeInSubtotalDiscount.Checked = clsProductGroupDetails.IncludeInSubtotalDiscount;
				txtVAT.Text = clsProductGroupDetails.VAT.ToString("#,##0.#0");
				txtEVAT.Text = clsProductGroupDetails.EVAT.ToString("#,##0.#0");
				txtLocalTax.Text = clsProductGroupDetails.LocalTax.ToString("#,##0.#0");
				clsProductGroup.CommitAndDispose();	
			}
		}
示例#12
0
		private void LoadRecord()
		{
			Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"],Session.SessionID));
			ProductGroup clsProductGroup = new ProductGroup();
			ProductGroupDetails clsDetails = clsProductGroup.Details(iID);
			clsProductGroup.CommitAndDispose();

			lblProductGroupID.Text = clsDetails.ProductGroupID.ToString();
			txtProductGroupCode.Text = clsDetails.ProductGroupCode;
			txtProductGroupName.Text = clsDetails.ProductGroupName;
			cboProductGroupUnit.SelectedIndex = cboProductGroupUnit.Items.IndexOf( cboProductGroupUnit.Items.FindByText(clsDetails.UnitDetails.UnitName));
			txtProductPrice.Text = clsDetails.Price.ToString("#,##0.#0");
			txtPurchasePrice.Text = clsDetails.PurchasePrice.ToString("#,##0.#0");
            chkIncludeInSubtotalDiscount.Checked = clsDetails.IncludeInSubtotalDiscount;
			txtVAT.Text = clsDetails.VAT.ToString("#,##0.#0");
			txtEVAT.Text = clsDetails.EVAT.ToString("#,##0.#0");
			txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0");
		}
示例#13
0
 protected void cboProductGroup_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     try
     {
         LoadSubGroup();
         if (cboProductGroup.SelectedItem.Value != Constants.ZERO_STRING)
         {
             ProductGroup clsProductGroup = new ProductGroup();
             ProductGroupDetails clsProductGroupDetails = clsProductGroup.Details(long.Parse(cboProductGroup.SelectedItem.Value));
             clsProductGroup.CommitAndDispose();
             txtVAT.Text = clsProductGroupDetails.VAT.ToString("#,##0.#0");
             txtEVAT.Text = clsProductGroupDetails.EVAT.ToString("#,##0.#0");
             txtLocalTax.Text = clsProductGroupDetails.LocalTax.ToString("#,##0.#0");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
		private void LoadOptions()
		{
            ProductGroup clsProductGroup = new ProductGroup();
            cboGroup.DataTextField = "ProductGroupName";
            cboGroup.DataValueField = "ProductGroupID";
            cboGroup.DataSource = clsProductGroup.ListAsDataTable();
            cboGroup.DataBind();
            cboGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING));
            cboGroup.SelectedIndex = 0;

            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroup clsSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction);
            cboSubGroup.DataTextField = "ProductSubGroupName";
            cboSubGroup.DataValueField = "ProductSubGroupID";
            cboSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending);
            cboSubGroup.DataBind();
            cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING));
            cboSubGroup.SelectedIndex = 0;
            clsProductGroup.CommitAndDispose();
		}
        protected void cboProductGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            Int64 intProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value);
            ProductSubGroup clsProductSubGroup = new ProductSubGroup();
            clsProductSubGroup.GetConnection();
            ProductGroup clsProductGroup = new ProductGroup(clsProductSubGroup.Connection, clsProductSubGroup.Transaction);
            ProductGroupDetails clsDetails;
            //System.Data.DataTable dtProductSubGroup;

            if (intProductGroupID == 0)
            {
                clsDetails = clsProductGroup.Details(DataConstants.DEFAULT_PRODUCT_GROUP);
            }
            else
            {
                clsDetails = clsProductGroup.Details(intProductGroupID);
            }

            ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails() { ProductGroupID = intProductGroupID };
            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroup clsSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction);
            cboProductSubGroup.DataTextField = "ProductSubGroupName";
            cboProductSubGroup.DataValueField = "ProductSubGroupID";
            cboProductSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending);
            cboProductSubGroup.DataBind();
            cboProductSubGroup.Items.Insert(0, new ListItem("Do not Apply to Product Sub Groups", "-1"));
            cboProductSubGroup.Items.Insert(1, new ListItem("Apply to all Product Sub Groups", "0"));
            cboProductSubGroup.SelectedIndex = cboProductSubGroup.Items.Count - 1;
            
            clsProductSubGroup.CommitAndDispose();

            cboChartOfAccountPurchase.SelectedIndex = cboChartOfAccountPurchase.Items.IndexOf(cboChartOfAccountPurchase.Items.FindByValue(clsDetails.ChartOfAccountIDPurchase.ToString()));
            cboChartOfAccountSold.SelectedIndex = cboChartOfAccountSold.Items.IndexOf(cboChartOfAccountSold.Items.FindByValue(clsDetails.ChartOfAccountIDSold.ToString()));
            cboChartOfAccountInventory.SelectedIndex = cboChartOfAccountInventory.Items.IndexOf(cboChartOfAccountInventory.Items.FindByValue(clsDetails.ChartOfAccountIDInventory.ToString()));
            cboChartOfAccountIDTaxPurchase.SelectedIndex = cboChartOfAccountIDTaxPurchase.Items.IndexOf(cboChartOfAccountIDTaxPurchase.Items.FindByValue(clsDetails.ChartOfAccountIDTaxPurchase.ToString()));
            cboChartOfAccountIDTaxSold.SelectedIndex = cboChartOfAccountIDTaxSold.Items.IndexOf(cboChartOfAccountIDTaxSold.Items.FindByValue(clsDetails.ChartOfAccountIDTaxSold.ToString()));

        }
示例#16
0
		private void Upload()
		{
			if( ( txtPath.PostedFile != null ) && ( txtPath.PostedFile.ContentLength > 0 ) )
			{
				string fn = System.IO.Path.GetFileName(txtPath.PostedFile.FileName);
				string SaveLocation = "/RetailPlus/temp/uploaded_" + fn;

				txtPath.PostedFile.SaveAs(SaveLocation);
				XmlTextReader reader = new XmlTextReader(SaveLocation);
				reader.WhitespaceHandling = WhitespaceHandling.None;

				Stock clsStock = new Stock();
				clsStock.GetConnection();

				string strStockTransactionNo = null;
				long StockID = 0;
				long ContactID = 0;
				int UnitID = 0;
				long ProductGroupID = 0;
				long ProductSubGroupID = 0;
				long ProductID = 0;
				long ProductBaseMatrixID = 0;

				VariationDetails clsVariationDetails;
				int VariationID = 0;

				StockItemDetails clsStockItemDetails = new StockItemDetails();

				while (reader.Read()) 
				{
					switch (reader.NodeType) 
					{
						case XmlNodeType.Element:
							if (reader.Name == "Stock") 
							{
								strStockTransactionNo = reader.GetAttribute("TransactionNo");

								StockID = clsStock.Details(reader.GetAttribute("TransactionNo")).StockID;
								if (StockID > 0)
								{
									clsStock.CommitAndDispose();
									Label1.Text = "<b>This file has already been added to inventory.<br />";
									Label1.Text += "Please refer to transaction No: " + strStockTransactionNo + ".</b>";
									reader.Close();
									return;
								}
								Contacts clsContact = new Contacts(clsStock.Connection, clsStock.Transaction);
								ContactID = clsContact.Details(reader.GetAttribute("ContactCode")).ContactID;
								if (ContactID == 0)
								{
									ContactDetails clsContactDetails = new ContactDetails();
									clsContactDetails.ContactCode = reader.GetAttribute("ContactCode");
									clsContactDetails.ContactName = reader.GetAttribute("ContactName");
									clsContactDetails.ContactGroupID = Convert.ToInt32(reader.GetAttribute("ContactGroupID"));
                                    clsContactDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), reader.GetAttribute("ModeOfTerms"));
									clsContactDetails.Terms = Convert.ToInt32(reader.GetAttribute("Terms"));
									clsContactDetails.Address = reader.GetAttribute("Address");
									clsContactDetails.BusinessName = reader.GetAttribute("BusinessName");
									clsContactDetails.TelephoneNo = reader.GetAttribute("TelephoneNo");
									clsContactDetails.Remarks = reader.GetAttribute("Remarks");
									clsContactDetails.Debit = Convert.ToDecimal(reader.GetAttribute("Debit"));
									clsContactDetails.Credit = Convert.ToDecimal(reader.GetAttribute("Credit"));
									clsContactDetails.IsCreditAllowed = Convert.ToBoolean(reader.GetAttribute("IsCreditAllowed"));
									clsContactDetails.CreditLimit = Convert.ToDecimal(reader.GetAttribute("CreditLimit"));
									ContactID = clsContact.Insert(clsContactDetails);
								}

                                StockDetails clsStockDetails = new StockDetails();
								clsStockDetails.TransactionNo = reader.GetAttribute("TransactionNo");
								clsStockDetails.StockTypeID = Convert.ToInt16(Constants.STOCK_TYPE_TRANSFER_FROM_BRANCH_ID);
								clsStockDetails.StockDate = DateTime.Now;
								clsStockDetails.SupplierID = ContactID;
								clsStockDetails.Remarks = reader.GetAttribute("StockRemarks") + Environment.NewLine + "Original Stock Date: " + reader.GetAttribute("StockDate");
								
								StockItemDetails[] itemDetails = new StockItemDetails[0];
								clsStockDetails.StockItems = itemDetails;

								StockID = clsStock.Insert(clsStockDetails);
							}
							else if (reader.Name == "Item") 
							{
								Data.Unit clsUnit = new Data.Unit(clsStock.Connection, clsStock.Transaction);
								UnitID = clsUnit.Details(reader.GetAttribute("ProductUnitCode")).UnitID;
								if (UnitID == 0) 
								{
									UnitDetails clsUnitDetails = new UnitDetails();
									clsUnitDetails.UnitCode = reader.GetAttribute("ProductUnitCode");
									clsUnitDetails.UnitName = reader.GetAttribute("ProductUnitName");
									UnitID = clsUnit.Insert(clsUnitDetails);
								}

								ProductGroup clsProductGroup = new ProductGroup(clsStock.Connection, clsStock.Transaction);
								ProductGroupID = clsProductGroup.Details(reader.GetAttribute("ProductGroupCode")).ProductGroupID;
								if (ProductGroupID == 0) 
								{
									Label1.Text += "inserting product group....";
									ProductGroupDetails clsProductGroupDetails = new ProductGroupDetails();
									clsProductGroupDetails.ProductGroupCode = reader.GetAttribute("ProductGroupCode");
									clsProductGroupDetails.ProductGroupName = reader.GetAttribute("ProductGroupName");
                                    clsProductGroupDetails.UnitDetails = new UnitDetails
                                    {
                                        UnitID = UnitID
                                    };
									clsProductGroupDetails.Price = Convert.ToDecimal(reader.GetAttribute("Price"));
									clsProductGroupDetails.PurchasePrice = Convert.ToDecimal(reader.GetAttribute("PurchasePrice"));
									clsProductGroupDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(reader.GetAttribute("IncludeInSubtotalDiscount"));
									clsProductGroupDetails.VAT = Convert.ToDecimal(reader.GetAttribute("VAT"));
									clsProductGroupDetails.EVAT = Convert.ToDecimal(reader.GetAttribute("EVAT"));
									clsProductGroupDetails.LocalTax = Convert.ToDecimal(reader.GetAttribute("LocalTax"));
									ProductGroupID = clsProductGroup.Insert(clsProductGroupDetails);
								}
								
								ProductSubGroup clsProductSubGroup = new ProductSubGroup(clsStock.Connection, clsStock.Transaction);
								ProductSubGroupID = clsProductSubGroup.Details(reader.GetAttribute("ProductSubGroupCode")).ProductSubGroupID;
								if (ProductSubGroupID == 0) 
								{
									Label1.Text += "inserting product sub-group....";
									ProductSubGroupDetails clsProductSubGroupDetails = new ProductSubGroupDetails();
									clsProductSubGroupDetails.ProductGroupID = ProductGroupID;
									clsProductSubGroupDetails.ProductSubGroupCode = reader.GetAttribute("ProductSubGroupCode");
									clsProductSubGroupDetails.ProductSubGroupName = reader.GetAttribute("ProductSubGroupName");
									clsProductSubGroupDetails.BaseUnitID = UnitID;
									clsProductSubGroupDetails.Price = Convert.ToDecimal(reader.GetAttribute("Price"));
									clsProductSubGroupDetails.PurchasePrice = Convert.ToDecimal(reader.GetAttribute("PurchasePrice"));
									clsProductSubGroupDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(reader.GetAttribute("IncludeInSubtotalDiscount"));
									clsProductSubGroupDetails.VAT = Convert.ToDecimal(reader.GetAttribute("VAT"));
									clsProductSubGroupDetails.EVAT = Convert.ToDecimal(reader.GetAttribute("EVAT"));
									clsProductSubGroupDetails.LocalTax = Convert.ToDecimal(reader.GetAttribute("LocalTax"));
									ProductSubGroupID = clsProductSubGroup.Insert(clsProductSubGroupDetails);
								}

								Products clsProduct = new Products(clsStock.Connection, clsStock.Transaction);
                                ProductID = clsProduct.Details(reader.GetAttribute("BarCode")).ProductID;
								if (ProductID == 0) 
								{
									Label1.Text += "inserting product....";
									ProductDetails clsProductDetails = new ProductDetails();
									clsProductDetails.ProductCode  = reader.GetAttribute("ProductCode");
									clsProductDetails.BarCode  = reader.GetAttribute("BarCode");
									clsProductDetails.ProductDesc = reader.GetAttribute("ProductDesc");
									clsProductDetails.ProductGroupID = ProductGroupID; 
									clsProductDetails.ProductSubGroupID  = ProductSubGroupID;
									clsProductDetails.ProductDesc  = reader.GetAttribute("ProductDesc");
									clsProductDetails.BaseUnitID = UnitID;
									clsProductDetails.Price = Convert.ToDecimal(reader.GetAttribute("Price")); 
									clsProductDetails.PurchasePrice = Convert.ToDecimal(reader.GetAttribute("PurchasePrice")); 
									clsProductDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(reader.GetAttribute("IncludeInSubtotalDiscount")); 
									clsProductDetails.VAT = Convert.ToDecimal(reader.GetAttribute("VAT")); 
									clsProductDetails.EVAT = Convert.ToDecimal(reader.GetAttribute("EVAT")); 
									clsProductDetails.LocalTax = Convert.ToDecimal(reader.GetAttribute("LocalTax")); 
									clsProductDetails.Quantity = 0;
									clsProductDetails.MinThreshold = Convert.ToDecimal(reader.GetAttribute("MinThreshold"));
									clsProductDetails.MaxThreshold = Convert.ToDecimal(reader.GetAttribute("MaxThreshold"));
									clsProductDetails.SupplierID = Contacts.DEFAULT_SUPPLIER_ID;
									ProductID = clsProduct.Insert(clsProductDetails);
								}

                                //ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(clsStock.Connection, clsStock.Transaction);
                                //ProductBaseMatrixID = clsProductVariationsMatrix.BaseDetails(0, 0, ProductID, reader["ItemBaseVariationDescription"].ToString()).MatrixID;
                                //if (ProductBaseMatrixID == 0)
                                //{
                                //    ProductBaseMatrixDetails clsBaseDetails = new ProductBaseMatrixDetails();
                                //    clsBaseDetails.ProductID = ProductID;
                                //    clsBaseDetails.Description = reader.GetAttribute("ItemBaseVariationDescription");
                                //    clsBaseDetails.UnitID = UnitID;
                                //    clsBaseDetails.Price = Convert.ToDecimal(reader.GetAttribute("Price"));
                                //    clsBaseDetails.PurchasePrice = Convert.ToDecimal(reader.GetAttribute("PurchasePrice"));
                                //    clsBaseDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(reader.GetAttribute("IncludeInSubtotalDiscount"));
                                //    clsBaseDetails.Quantity = 0;
                                //    clsBaseDetails.VAT = Convert.ToDecimal(reader.GetAttribute("VAT"));
                                //    clsBaseDetails.EVAT = Convert.ToDecimal(reader.GetAttribute("EVAT"));
                                //    clsBaseDetails.LocalTax = Convert.ToDecimal(reader.GetAttribute("LocalTax"));
                                //    clsBaseDetails.MinThreshold = Convert.ToDecimal(reader.GetAttribute("MinThreshold"));
                                //    clsBaseDetails.MaxThreshold = Convert.ToDecimal(reader.GetAttribute("MaxThreshold"));
                                //    ProductBaseMatrixID = clsProductVariationsMatrix.InsertBaseVariation(clsBaseDetails);
                                //    clsBaseDetails.MatrixID = ProductBaseMatrixID;
                                //}

								clsStockItemDetails = new StockItemDetails();
								clsStockItemDetails.StockID = StockID;
								clsStockItemDetails.ProductID = ProductID;
								clsStockItemDetails.VariationMatrixID = ProductBaseMatrixID;
								clsStockItemDetails.ProductUnitID = UnitID;
								clsStockItemDetails.StockTypeID = Convert.ToInt16(Constants.STOCK_TYPE_TRANSFER_FROM_BRANCH_ID);
								clsStockItemDetails.StockDate = DateTime.Now;
								clsStockItemDetails.Quantity = Convert.ToDecimal(reader.GetAttribute("ItemQuantity"));
								clsStockItemDetails.Remarks = reader.GetAttribute("ItemRemarks");

                                Security.AccessUserDetails clsAccessUserDetails = (Security.AccessUserDetails)Session["AccessUserDetails"];
                                clsStock.AddItem(Constants.BRANCH_ID_MAIN, strStockTransactionNo, clsAccessUserDetails.Name, clsStockItemDetails, StockDirections.Increment);
							}
							else if (reader.Name == "Variation" && reader.GetAttribute("VariationCode") != null)
							{
								Variation clsVariation = new Variation(clsStock.Connection, clsStock.Transaction);
								VariationID = clsVariation.Details(reader.GetAttribute("VariationCode")).VariationID;
								if (VariationID == 0 ) 
								{	
									clsVariationDetails = new VariationDetails();
									clsVariationDetails.VariationCode = reader.GetAttribute("VariationCode");
									clsVariationDetails.VariationType = reader.GetAttribute("VariationType");
									VariationID = clsVariation.Insert(clsVariationDetails);
								}

								ProductVariationDetails clsProductVariationDetails = new ProductVariationDetails();
								clsProductVariationDetails.ProductID = ProductID;
								clsProductVariationDetails.VariationID = VariationID;

								ProductVariations clsProductVariation = new ProductVariations(clsStock.Connection, clsStock.Transaction);
								if (clsProductVariation.isExist(clsProductVariationDetails) == false)
								{
									long ProductVariationID = clsProductVariation.Insert(clsProductVariationDetails);
								}

							}
							else if (reader.Name == "VariationMatrix" && reader.GetAttribute("VariationCode") != null)
							{
								Variation clsVariation = new Variation(clsStock.Connection, clsStock.Transaction);
								VariationID = clsVariation.Details(reader.GetAttribute("VariationCode")).VariationID;
								if (VariationID == 0) 
								{
									clsVariationDetails = new VariationDetails();
									clsVariationDetails.VariationCode = reader.GetAttribute("VariationCode");
									clsVariationDetails.VariationType = reader.GetAttribute("VariationType");
									VariationID = clsVariation.Insert(clsVariationDetails);
								}

								ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(clsStock.Connection, clsStock.Transaction);
								if (clsProductVariationsMatrix.isExist(ProductBaseMatrixID, VariationID) == false)
								{
									ProductVariationsMatrixDetails clsProductVariationsMatrixDetails = new ProductVariationsMatrixDetails();
                                    clsProductVariationsMatrixDetails.ProductID = ProductID;
                                    clsProductVariationsMatrixDetails.MatrixID = ProductBaseMatrixID;
									clsProductVariationsMatrixDetails.VariationID = VariationID;
									clsProductVariationsMatrixDetails.Description = reader.GetAttribute("Description");
									clsProductVariationsMatrix.SaveVariation(clsProductVariationsMatrixDetails);
								}
							}
							else
							{
								Label1.Text = "<b>Reader Name:<b>" + reader.Name + "<br />";
							}
							break;
						case XmlNodeType.Text:
							Label1.Text = "<b>" + reader.LocalName + ":<b>" + reader.Value + "<br />";
							break;
					}       
				}
				reader.Close();
				
				clsStock.CommitAndDispose();
				Label1.Text = "<b>Transaction No.: " + strStockTransactionNo + " has been successfully transferred.<br />";
			}
			else
			{
				Response.Write("Please select a file to upload.");
			}

		}
示例#17
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();
			Int64 groupid = Convert.ToInt64(Common.Decrypt(Request.QueryString["groupid"].ToString(),Session.SessionID));
			lblGroupID.Text = Convert.ToString(groupid);
			
			ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix();
			ProductGroupUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(groupid);

			if (clsUnitDetails.BottomUnitName == null)
			{
				ProductGroup clsProductGroup = new ProductGroup();
				ProductGroupDetails clsDetails = clsProductGroup.Details(groupid);
				clsProductGroup.CommitAndDispose();

				txtBaseUnit.Text = clsDetails.UnitDetails.UnitName;
				lblBaseUnitID.Text = clsDetails.UnitDetails.UnitID.ToString();
			}
			else
			{
				txtBaseUnit.Text = clsUnitDetails.BottomUnitName;
				lblBaseUnitID.Text = Convert.ToString(clsUnitDetails.BottomUnitID);
			}

			cboBottomUnit.DataTextField = "UnitName";
			cboBottomUnit.DataValueField = "UnitID";
			cboBottomUnit.DataSource = clsDataClass.DataReaderToDataTable(clsUnitMatrix.AvailableUnitsForProduct(groupid,"UnitName",SortOption.Ascending)).DefaultView;
			cboBottomUnit.DataBind();
			if (cboBottomUnit.Items.Contains( new ListItem(txtBaseUnit.Text, lblBaseUnitID.Text)))
			{
				cboBottomUnit.Items.RemoveAt( cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(lblBaseUnitID.Text)));
			}
			cboBottomUnit.SelectedIndex = cboBottomUnit.Items.Count - 1;

			clsUnitMatrix.CommitAndDispose();
		}
		private void SaveRecord()
		{
            long lProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value);
            long lProductSubGroupID = Convert.ToInt64(cboProductSubGroup.SelectedItem.Value);
            long lProductID = Convert.ToInt64(cboProduct.SelectedItem.Value);

            int iChartOfAccountIDPurchase = Convert.ToInt32(cboChartOfAccountPurchase.SelectedItem.Value);
            int iChartOfAccountIDSold = Convert.ToInt32(cboChartOfAccountSold.SelectedItem.Value);
            int iChartOfAccountIDInventory = Convert.ToInt32(cboChartOfAccountInventory.SelectedItem.Value);
            int iChartOfAccountIDTaxPurchase = Convert.ToInt32(cboChartOfAccountIDTaxPurchase.SelectedItem.Value);
            int iChartOfAccountIDTaxSold = Convert.ToInt32(cboChartOfAccountIDTaxSold.SelectedItem.Value);

            ProductGroup clsProductGroup = new ProductGroup();
            clsProductGroup.GetConnection();
            ProductSubGroup clsProductSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction);
            Products clsProduct = new Products(clsProductGroup.Connection,clsProductGroup.Transaction);

            if (lProductGroupID == 0)
            {
                clsProductGroup.UpdateFinancialInformation(iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                if (lProductSubGroupID == 0)
                {
                    clsProductSubGroup.UpdateFinancialInformation(iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    if (lProductID == 0)
                    {
                        clsProduct.UpdateFinancialInformation(iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                    else
                    {
                        clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);        
                    }
                }
                else if (lProductSubGroupID > 0)
                {
                    clsProductSubGroup.UpdateFinancialInformation(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    if (lProductID == 0)
                    {
                        clsProduct.UpdateFinancialInformationBySubGroup(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                    else
                    {
                        clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                }
            }
            else
            {
                clsProductGroup.UpdateFinancialInformation(lProductGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                if (lProductSubGroupID == 0)
                {
                    clsProductSubGroup.UpdateFinancialInformationByGroup(lProductGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    if (lProductID == 0)
                    {
                        clsProduct.UpdateFinancialInformationByGroup(lProductGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                    else
                    {
                        clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                }
                else if (lProductSubGroupID > 0)
                {
                    clsProductSubGroup.UpdateFinancialInformation(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    if (lProductID == 0)
                    {
                        clsProduct.UpdateFinancialInformationBySubGroup(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                    else
                    {
                        clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                }
            }
            
            clsProductGroup.CommitAndDispose();
		}
示例#19
0
		private bool Delete()
		{
			bool boRetValue = false;
			string stIDs = "";

			foreach(DataListItem item in lstItem.Items)
			{
				HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList");
				if (chkList!=null)
				{
					if (chkList.Checked == true)
					{
						stIDs += chkList.Value + ",";		
						boRetValue = true;
					}
				}
			}
			if (boRetValue)
			{
				ProductGroup clsProductGroup = new ProductGroup();
				clsProductGroup.Delete( stIDs.Substring(0,stIDs.Length-1));
				clsProductGroup.CommitAndDispose();
			}

			return boRetValue;
		}
示例#20
0
		private void LoadList()
		{	
			ProductGroup clsProductGroup = new ProductGroup();
			DataClass clsDataClass = new DataClass();

			string SortField = "a.ProductGroupID";
			if (Request.QueryString["sortfield"]!=null)
			{	SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID);	}
			
			SortOption sortoption = SortOption.Ascending;
			if (Request.QueryString["sortoption"]!=null)
			{	sortoption = (SortOption) Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true);	}

            string SearchKey = "";
			if (Request.QueryString["Search"]!=null)
			{
                SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID);
			}
            PageData.DataSource = clsProductGroup.ListAsDataTable(SearchKey, SortField, sortoption).DefaultView;
			clsProductGroup.CommitAndDispose();

			int iPageSize = Convert.ToInt16(Session["PageSize"]) ;
			
			PageData.AllowPaging = true;
			PageData.PageSize = iPageSize;
			try
			{
				PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;				
				lstItem.DataSource = PageData;
				lstItem.DataBind();
			}
			catch
			{
				PageData.CurrentPageIndex = 1;
				lstItem.DataSource = PageData;
				lstItem.DataBind();
			}			
			
			cboCurrentPage.Items.Clear();
			for (int i=0; i < PageData.PageCount;i++)
			{
				int iValue = i + 1;
				cboCurrentPage.Items.Add(new ListItem(iValue.ToString(),iValue.ToString()));
				if (PageData.CurrentPageIndex == i)
				{	cboCurrentPage.Items[i].Selected = true;}
				else
				{	cboCurrentPage.Items[i].Selected = false;}
			}
			lblDataCount.Text = " of " + " " + PageData.PageCount;
		}
示例#21
0
        protected void lstItem_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
		{
			HtmlInputCheckBox chkList = null;
			string stParam = string.Empty;

			chkList = (HtmlInputCheckBox) e.Item.FindControl("chkList");
			stParam = "?task=" + Common.Encrypt("list",Session.SessionID) + "&groupid=" + Common.Encrypt(chkList.Value,Session.SessionID);

			switch(e.CommandName)
			{
                case "imgItemDelete":
                    ProductGroup clsProductGroup = new ProductGroup();
                    clsProductGroup.Delete(chkList.Value);
                    clsProductGroup.CommitAndDispose();

                    LoadList();
                    break;
                case "imgItemEdit":
                    stParam = "?task=" + Common.Encrypt("edit", Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID);
                    Response.Redirect("Default.aspx" + stParam);
                    break;
				case "imgVariationsClick":
					Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductGroup/_Variations/Default.aspx" + stParam);
					break;
				case "imgVariationsMatrixClick":
                    Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductGroup/_VariationsMatrix/Default.aspx" + stParam);
					break;
				case "imgUnitsMatrixClick":
                    Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductGroup/_UnitsMatrix/Default.aspx" + stParam);
					break;
			}
		}
示例#22
0
		private void LoadOptions()
		{
            Int64 UID = Convert.ToInt64(Session["UID"]);
            Security.AccessRights clsAccessRights = new Security.AccessRights();
            Security.AccessRightsDetails clsDetails = clsAccessRights.Details(UID,(int) AccessTypes.SummarizedDailySalesWithTFDetailed);
            clsAccessRights.CommitAndDispose();

            cboReportType.Items.Clear();
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION));
            cboReportType.Items.Add(new ListItem(ReportTypes.SummarizeDailySales, ReportTypes.SummarizeDailySales));

            if (clsDetails.Read)
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerDay, ReportTypes.SalesPerDay));

            if (cboReportType.Items.Count == 2) cboReportType.Items.RemoveAt(cboReportType.Items.IndexOf(cboReportType.Items.FindByValue(ReportTypes.REPORT_SELECTION)));
			cboReportType.SelectedIndex = 0;

            cboConsignment.Items.Clear();
            cboConsignment.Items.Add(new ListItem("Both", "-1"));
            cboConsignment.Items.Add(new ListItem("Yes", true.ToString()));
            cboConsignment.Items.Add(new ListItem("No", false.ToString()));

			cboTransactionStatus.Items.Clear();
			foreach(string status in Enum.GetNames(typeof(TransactionStatus)))
			{
				cboTransactionStatus.Items.Add(new ListItem(status, status));
			}
			cboTransactionStatus.SelectedIndex = cboTransactionStatus.Items.IndexOf( cboTransactionStatus.Items.FindByText(TransactionStatus.NotYetApplied.ToString()));

			cboPaymentType.Items.Clear();
			foreach(string PaymentType in Enum.GetNames(typeof(PaymentTypes)))
			{
				cboPaymentType.Items.Add(new ListItem(PaymentType, PaymentType));
			}
			cboPaymentType.SelectedIndex = cboPaymentType.Items.IndexOf( cboPaymentType.Items.FindByText(PaymentTypes.NotYetAssigned.ToString()));

			txtStartTransactionDate.Text = Common.ToShortDateString(DateTime.Now.AddDays(-1));
            txtEndTransactionDate.Text = Common.ToShortDateString(DateTime.Now);

            Customer clsCustomer = new Customer();
            cboContactName.DataTextField = "ContactName";
            cboContactName.DataValueField = "ContactID";
            cboContactName.DataSource = clsCustomer.CustomersDataTable(txtContactName.Text, 0, false, "ContactName", SortOption.Ascending);
            cboContactName.DataBind();
            if (string.IsNullOrEmpty(txtContactName.Text))
                cboContactName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboContactName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactName.Text, Constants.ZERO_STRING));
            cboContactName.SelectedIndex = 0;

            cboAgent.Items.Clear();
            Contacts clsContact = new Contacts(clsCustomer.Connection, clsCustomer.Transaction);
            cboAgent.DataTextField = "ContactName";
            cboAgent.DataValueField = "ContactID";
            cboAgent.DataSource = clsContact.AgentsAsDataTable(txtAgent.Text, 0, "ContactName", SortOption.Ascending);
            cboAgent.DataBind();
            if (string.IsNullOrEmpty(txtAgent.Text))
                cboAgent.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboAgent.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtAgent.Text, Constants.ZERO_STRING));
            cboAgent.SelectedIndex = 0;

            Terminal clsTerminal = new Terminal(clsCustomer.Connection, clsCustomer.Transaction);
            cboTerminalNo.DataTextField = "TerminalNo";
            cboTerminalNo.DataValueField = "TerminalNo";
            cboTerminalNo.DataSource = clsTerminal.ListAsDataTable();
            cboTerminalNo.DataBind();
            cboTerminalNo.Items.Insert(0, new ListItem(Constants.ALL, Constants.ALL));
            cboTerminalNo.SelectedIndex = 0;

            Branch clsBranch = new Branch(clsCustomer.Connection, clsCustomer.Transaction);
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable(OnlyIncludeIneSales: true).DefaultView;
            cboBranch.DataBind();
            cboBranch.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboBranch.SelectedIndex = 0;

            Security.AccessUser clsAccessUser = new Security.AccessUser(clsCustomer.Connection, clsCustomer.Transaction);
            cboCashierName.DataTextField = "Name";
            cboCashierName.DataValueField = "UID";
            cboCashierName.DataSource = clsAccessUser.Cashiers(txtCashierName.Text, 0);
            cboCashierName.DataBind();
            if (string.IsNullOrEmpty(txtCashierName.Text))
                cboCashierName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboCashierName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtCashierName.Text, Constants.ZERO_STRING));
            cboCashierName.SelectedIndex = 0;

            ProductGroup clsProductGroup = new ProductGroup(clsCustomer.Connection, clsCustomer.Transaction);
            cboProductGroup.DataTextField = "ProductGroupName";
            cboProductGroup.DataValueField = "ProductGroupName";
            cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName");
            cboProductGroup.DataBind();
            cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboProductGroup.SelectedIndex = 0;
            clsCustomer.CommitAndDispose();

            #region Sales Per Day
            cboMonth.Items.Add(new ListItem("January", "1"));
            cboMonth.Items.Add(new ListItem("February", "2"));
            cboMonth.Items.Add(new ListItem("March", "3"));
            cboMonth.Items.Add(new ListItem("April", "4"));
            cboMonth.Items.Add(new ListItem("May", "5"));
            cboMonth.Items.Add(new ListItem("June", "6"));
            cboMonth.Items.Add(new ListItem("July", "7"));
            cboMonth.Items.Add(new ListItem("August", "8"));
            cboMonth.Items.Add(new ListItem("September", "9"));
            cboMonth.Items.Add(new ListItem("October", "10"));
            cboMonth.Items.Add(new ListItem("November", "11"));
            cboMonth.Items.Add(new ListItem("Decemeber", "12"));
            cboMonth.SelectedIndex = DateTime.Now.Month - 1;

            int x = 2007;
            while (x <= DateTime.Now.Year)
            {
                cboYear.Items.Add(new ListItem(x.ToString(), x.ToString()));
                x++;
            }
            cboYear.SelectedIndex = cboYear.Items.Count - 1;
            #endregion
        }
示例#23
0
		private void LoadOptions()
		{
            txtStartDate.Text = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd");
            txtEndDate.Text = DateTime.Now.ToString("yyyy-MM-dd");

            Int64 UID = Convert.ToInt64(Session["UID"]);
            Security.AccessRights clsAccessRights = new Security.AccessRights();

            cboReportType.Items.Clear();
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION));

            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
            cboReportType.Items.Add(new ListItem(ReportTypes.ProductList, ReportTypes.ProductList));

            if (clsAccessRights.Details(UID, (int)AccessTypes.PricesReport).Read)
            { cboReportType.Items.Add(new ListItem(ReportTypes.ProductPriceList, ReportTypes.ProductPriceList)); }
            
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
            cboReportType.Items.Add(new ListItem(ReportTypes.ProductListWithInvalidMatrix, ReportTypes.ProductListWithInvalidMatrix));
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
            cboReportType.Items.Add(new ListItem(ReportTypes.WeightedProductsForWeighingScale, ReportTypes.WeightedProductsForWeighingScale));
            cboReportType.Items.Add(new ListItem(ReportTypes.CountedProductsForWeighingScale, ReportTypes.CountedProductsForWeighingScale));
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));

            if (clsAccessRights.Details(UID, (int)AccessTypes.ProductsInDemoReport).Read)
                cboReportType.Items.Add(new ListItem(ReportTypes.ProductsInDemoReport, ReportTypes.ProductsInDemoReport));

            clsAccessRights.CommitAndDispose();
            cboReportType.SelectedIndex = 0;
            

            Branch clsBranch = new Branch();
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranch.DataBind();
            cboBranch.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboBranch.SelectedIndex = 0;

            Contacts clsContact = new Contacts(clsBranch.Connection, clsBranch.Transaction);
            cboContact.DataTextField = "ContactName";
            cboContact.DataValueField = "ContactID";
            cboContact.DataSource = clsContact.SuppliersAsDataTable(txtContactCode.Text, 100).DefaultView;
            cboContact.DataBind();
            cboContact.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboContact.SelectedIndex = 0;

            ProductGroup clsProductGroup = new ProductGroup(clsBranch.Connection, clsBranch.Transaction);
            cboProductGroup.DataTextField = "ProductGroupName";
            cboProductGroup.DataValueField = "ProductGroupID";
            cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(txtProductGroupCode.Text, "ProductGroupName").DefaultView;
            cboProductGroup.DataBind();
            cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboProductGroup.SelectedIndex = 0;

            clsBranch.CommitAndDispose();

            cboProductGroup_SelectedIndexChanged(null, System.EventArgs.Empty);
		}
        private void LoadList()
        {
            string SortField = "ProductCode";
            if (Request.QueryString["sortfield"] != null)
            { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); }

            SortOption sortoption = SortOption.Ascending;
            if (Request.QueryString["sortoption"] != null)
            { sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); }

            Int64 lngProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value);

            ProductInventories clsProductInventories = new ProductInventories();
            System.Data.DataTable dt = clsProductInventories.ListAsDataTable(BranchID: int.Parse(cboBranch.SelectedItem.Value), ProductGroupID: lngProductGroupID, clsProductListFilterType: ProductListFilterType.ShowActiveOnly, SortField: "ProductDesc ASC, MatrixDescription ASC, BarCode1", SortOrder: SortOption.Desscending);

            ProductGroup clsProductGroup = new ProductGroup(clsProductInventories.Connection, clsProductInventories.Transaction);
            ProductGroupDetails clsProductGroupDetails = clsProductGroup.Details(lngProductGroupID);

            clsProductInventories.CommitAndDispose();

            PageData.DataSource = dt.DefaultView;

            if (!clsProductGroupDetails.isLock)
            {
                cmdLockUnlockProduct.Text = "Lock Product Group [<label class='ms-error'>Note:</label>Products under this group are <u>CURRENTLY ALLOWED</u> for Selling]";
                cmdLockUnlockProduct.ToolTip = "unlock";
            }
            else
            {
                cmdLockUnlockProduct.Text = "UnLock Product Group [<label class='ms-error'>Note:</label>Products under this group are <u>CURRENTLY NOT ALLOWED</u> for Selling]";
                cmdLockUnlockProduct.ToolTip = "lock";
            }

            int iPageSize = Convert.ToInt16(Session["PageSize"]);

            PageData.AllowPaging = true;
            PageData.PageSize = 5000;
            try
            {
                PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;
                lstItem.DataSource = PageData;
                lstItem.DataBind();
            }
            catch
            {
                PageData.CurrentPageIndex = 1;
                lstItem.DataSource = PageData;
                lstItem.DataBind();
            }

            cboCurrentPage.Items.Clear();
            for (int iRow = 0; iRow < PageData.PageCount; iRow++)
            {
                int iValue = iRow + 1;
                cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString()));
                if (PageData.CurrentPageIndex == iRow)
                { cboCurrentPage.Items[iRow].Selected = true; }
                else
                { cboCurrentPage.Items[iRow].Selected = false; }
            }
            lblDataCount.Text = " of " + " " + PageData.PageCount;
        }
示例#25
0
		private Int64 SaveRecord()
		{
			ProductGroupDetails clsDetails = new ProductGroupDetails();

			clsDetails.ProductGroupCode = txtProductGroupCode.Text;
			clsDetails.ProductGroupName = txtProductGroupName.Text;
            clsDetails.UnitDetails = new UnitDetails
            {
                UnitID = Convert.ToInt32(cboProductGroupUnit.SelectedItem.Value)
            };
			clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text);
			clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text);
			clsDetails.IncludeInSubtotalDiscount = chkIncludeInSubtotalDiscount.Checked;
			clsDetails.VAT = Convert.ToDecimal(txtVAT.Text);
			clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text);
			clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text);

			ProductGroup clsProductGroup = new ProductGroup();
			Int64 id = clsProductGroup.Insert(clsDetails);
			clsProductGroup.CommitAndDispose();

			return id;
		}
示例#26
0
		private void LoadOptions()
		{
			ProductGroup clsProductGroup = new ProductGroup();
			DataClass clsDataClass = new DataClass();
			
			cboGroup.DataTextField = "ProductGroupName";
			cboGroup.DataValueField = "ProductGroupID";
			cboGroup.DataSource = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName").DefaultView;
			cboGroup.DataBind();
			cboGroup.SelectedIndex = cboGroup.Items.Count - 1;
			cboGroup_SelectedIndexChanged(null, System.EventArgs.Empty);

            Data.Unit clsUnit = new Data.Unit();
			
			cboProductSubGroupUnit.DataTextField = "UnitName";
			cboProductSubGroupUnit.DataValueField = "UnitID";
			cboProductSubGroupUnit.DataSource = clsUnit.ListAsDataTable(SortField:"UnitName").DefaultView;
			cboProductSubGroupUnit.DataBind();
			cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.Count - 1;

            Terminal clsTerminal = new Terminal(clsUnit.Connection, clsUnit.Transaction);
            TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString());
            txtVAT.Text = clsTerminalDetails.VAT.ToString("###.#0");
            txtEVAT.Text = clsTerminalDetails.EVAT.ToString("###.#0");
            txtLocalTax.Text = clsTerminalDetails.LocalTax.ToString("###.#0");

			clsUnit.CommitAndDispose();

			if (cboGroup.Items.Count != 0)
			{
				Int32 BaseUnitID= clsProductGroup.Details(Convert.ToInt32(cboGroup.SelectedItem.Value)).UnitDetails.UnitID;
				cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.IndexOf( cboProductSubGroupUnit.Items.FindByValue(BaseUnitID.ToString()));
			}
			clsProductGroup.CommitAndDispose();	
		}
		private void LoadOptions()
		{
            txtStartTransactionDate.Text = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd");
            txtEndTransactionDate.Text = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");

            Contacts clsContact = new Contacts();
            cboContact.DataTextField = "ContactName";
            cboContact.DataValueField = "ContactID";
            cboContact.DataSource = clsContact.SuppliersAsDataTable(Limit: 100).DefaultView;
            cboContact.DataBind();
            cboContact.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.ZERO_STRING));
            cboContact.SelectedIndex = 0;

            ProductGroup clsProductGroup = new ProductGroup(clsContact.Connection, clsContact.Transaction);
            cboGroup.DataTextField = "ProductGroupName";
            cboGroup.DataValueField = "ProductGroupID";
            cboGroup.DataSource = clsProductGroup.ListAsDataTable();
            cboGroup.DataBind();
            cboGroup.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT,Constants.ZERO_STRING));
            cboGroup.SelectedIndex = 0;

            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroup clsProductSubGroup = new ProductSubGroup(clsContact.Connection, clsContact.Transaction);
            cboSubGroup.DataTextField = "ProductSubGroupName";
            cboSubGroup.DataValueField = "ProductSubGroupID";
            cboSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns);
            cboSubGroup.DataBind();
            cboSubGroup.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.ZERO_STRING));
            cboSubGroup.SelectedIndex = 0;

            Data.Inventory clsInventory = new Data.Inventory(clsContact.Connection, clsContact.Transaction);
            cboInventoryNo.DataTextField = "ReferenceNo";
            cboInventoryNo.DataValueField = "PostingReference";
            cboInventoryNo.DataSource = clsInventory.ClosingInventoryReferenceNos(Convert.ToDateTime(txtStartTransactionDate.Text), Convert.ToDateTime(txtEndTransactionDate.Text));
            cboInventoryNo.DataBind();
            cboInventoryNo.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.PLEASE_SELECT + DateTime.MinValue.ToString("yyyy-MM-dd")));
            cboInventoryNo.SelectedIndex = 0;

            clsContact.CommitAndDispose();

            lblType.Text = ""; lblType.ToolTip = "";
            if (Request.QueryString["type"] != null)
            {
                lblType.Text = Common.Decrypt(Request.QueryString["type"].ToString(), Session.SessionID);
            }
            if (Request.QueryString["typedet"] != null)
            {
                lblType.ToolTip = Common.Decrypt(Request.QueryString["typedet"].ToString(), Session.SessionID);
            }
            lblBranchID.Text = "0";
            if (Request.QueryString["branchid"] != null)
            {
                lblBranchID.Text = Common.Decrypt(Request.QueryString["branchid"].ToString(), Session.SessionID);
            }

            if (Request.QueryString["refno"] != null)
            {
                string strRefNo = "refno";
                strRefNo = Common.Decrypt(Request.QueryString["refno"].ToString(), Session.SessionID);
                cboInventoryNo.SelectedIndex = cboInventoryNo.Items.IndexOf(cboInventoryNo.Items.FindByText(strRefNo));
            }

            if (Request.QueryString["prdgrpid"] != null)
            {
                string strPrdGrpID = "prdgrpid";
                strPrdGrpID = Common.Decrypt(Request.QueryString["prdgrpid"].ToString(), Session.SessionID);
                cboGroup.SelectedIndex = cboGroup.Items.IndexOf(cboGroup.Items.FindByValue(strPrdGrpID));
            }

            if (Request.QueryString["contactid"] != null)
            {
                string strContactID = "contactid";
                strContactID = Common.Decrypt(Request.QueryString["contactid"].ToString(), Session.SessionID);
                cboContact.SelectedIndex = cboContact.Items.IndexOf(cboContact.Items.FindByValue(strContactID));
            }
		}
示例#28
0
		private void LoadOptions()
		{
            Int64 UID = Convert.ToInt64(Session["UID"]);
            Security.AccessRights clsAccessRights = new Security.AccessRights();

            cboReportType.Items.Clear();
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION));
            if (clsAccessRights.Details(UID, (int)AccessTypes.SummarizedDailySales).Read)
            {
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.SummarizeDailySales, ReportTypes.SummarizeDailySales));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerDay, ReportTypes.SalesPerDay));
            }
            //if (clsAccessRights.Details(UID, (int)AccessTypes.SummarizedDailySalesWithTF).Read)
            //{
            //    cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
            //    cboReportType.Items.Add(new ListItem(ReportTypes.SummarizeDailySalesWithTF, ReportTypes.SummarizeDailySalesWithTF));
            //    cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerDayWithTF, ReportTypes.SalesPerDayWithTF));
            //}
            if (clsAccessRights.Details(UID, (int)AccessTypes.SalesTransactionReport).Read)
            {
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerHour, ReportTypes.SalesPerHour));
                
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactions, ReportTypes.SalesTransactions));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomer, ReportTypes.SalesTransactionPerCustomer));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerPerGroup, ReportTypes.SalesTransactionPerCustomerPerGroup));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerPerGroupSummarized, ReportTypes.SalesTransactionPerCustomerPerGroupSummarized));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerWithCheque, ReportTypes.SalesTransactionPerCustomerWithCheque));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerPerItem, ReportTypes.SalesTransactionPerCustomerPerItem));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCashier, ReportTypes.SalesTransactionPerCashier));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCashierPerCustomer, ReportTypes.SalesTransactionPerCashierPerCustomer));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerTerminal, ReportTypes.SalesTransactionPerTerminal));

                if (clsAccessRights.Details(UID, (int)AccessTypes.SalesTransactionPerItem).Read)
                {
                    cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerItem, ReportTypes.SalesTransactionPerItem));
                }
                if (clsAccessRights.Details(UID, (int)AccessTypes.SalesTransactionPerItemWoutPurchaseDetails).Read)
                {
                    cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerItemWoutPurchaseDetails, ReportTypes.SalesTransactionPerItemWoutPurchaseDetails));
                }

                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.CashSalesDaily, ReportTypes.CashSalesDaily));
                cboReportType.Items.Add(new ListItem(ReportTypes.CashSalesMonthly, ReportTypes.CashSalesMonthly));
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.ChequePaymentList, ReportTypes.ChequePaymentList));
                cboReportType.Items.Add(new ListItem(ReportTypes.ChequeSalesDaily, ReportTypes.ChequeSalesDaily));
                cboReportType.Items.Add(new ListItem(ReportTypes.ChequeSalesMonthly, ReportTypes.ChequeSalesMonthly));
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.CreditCardSalesDaily, ReportTypes.CreditCardSalesDaily));
                cboReportType.Items.Add(new ListItem(ReportTypes.CreditCardSalesMonthly, ReportTypes.CreditCardSalesMonthly));
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.DailySalesTransaction, ReportTypes.DailySalesTransaction));
                cboReportType.Items.Add(new ListItem(ReportTypes.WeeklySalesTransaction, ReportTypes.WeeklySalesTransaction));
                cboReportType.Items.Add(new ListItem(ReportTypes.MonthlySalesTransaction, ReportTypes.MonthlySalesTransaction));
            }
            if (clsAccessRights.Details(UID, (int)AccessTypes.PaidOutDisburseROC).Read)
            {
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.PaidOut, ReportTypes.PaidOut));
                cboReportType.Items.Add(new ListItem(ReportTypes.Disburse, ReportTypes.Disburse));
                cboReportType.Items.Add(new ListItem(ReportTypes.RecieveOnAccount, ReportTypes.RecieveOnAccount));
            }
			cboReportType.SelectedIndex = 0;

            clsAccessRights.CommitAndDispose();

            cboConsignment.Items.Clear();
            cboConsignment.Items.Add(new ListItem("Both", "-1"));
            cboConsignment.Items.Add(new ListItem("Yes", true.ToString()));
            cboConsignment.Items.Add(new ListItem("No", false.ToString()));

			cboTransactionStatus.Items.Clear();
			foreach(string status in Enum.GetNames(typeof(TransactionStatus)))
			{
				cboTransactionStatus.Items.Add(new ListItem(status, status));
			}
			cboTransactionStatus.SelectedIndex = cboTransactionStatus.Items.IndexOf( cboTransactionStatus.Items.FindByText(TransactionStatus.NotYetApplied.ToString()));

			cboPaymentType.Items.Clear();
			foreach(string PaymentType in Enum.GetNames(typeof(PaymentTypes)))
			{
				cboPaymentType.Items.Add(new ListItem(PaymentType, PaymentType));
			}
			cboPaymentType.SelectedIndex = cboPaymentType.Items.IndexOf( cboPaymentType.Items.FindByText(PaymentTypes.NotYetAssigned.ToString()));

			txtStartValidityDate.Text = Common.ToShortDateString(DateTime.Now);
            txtEndValidityDate.Text = Common.ToShortDateString(DateTime.Now.AddDays(30));

            txtStartTransactionDate.Text = Common.ToShortDateString(DateTime.Now.AddDays(-1));
            txtEndTransactionDate.Text = Common.ToShortDateString(DateTime.Now);
            
            Customer clsCustomer = new Customer();
            cboContactName.DataTextField = "ContactName";
            cboContactName.DataValueField = "ContactID";
            cboContactName.DataSource = clsCustomer.CustomersDataTable(txtContactName.Text, 0, false, "ContactName", SortOption.Ascending);
            cboContactName.DataBind();
            if (string.IsNullOrEmpty(txtContactName.Text))
                cboContactName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboContactName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactName.Text, Constants.ZERO_STRING));
            cboContactName.SelectedIndex = 0;

            ContactGroups clsContactGroups = new ContactGroups(clsCustomer.Connection, clsCustomer.Transaction);
            cboContactGroupName.DataTextField = "ContactGroupName";
            cboContactGroupName.DataValueField = "ContactGroupID";
            cboContactGroupName.DataSource = clsContactGroups.ListAsDataTable(ContactGroupCategory.CUSTOMER, txtContactGroupName.Text);
            cboContactGroupName.DataBind();
            if (string.IsNullOrEmpty(txtContactName.Text))
                cboContactGroupName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboContactGroupName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactGroupName.Text, Constants.ZERO_STRING));
            cboContactGroupName.SelectedIndex = 0;


            cboAgent.Items.Clear();
            Contacts clsContact = new Contacts(clsCustomer.Connection, clsCustomer.Transaction);
            cboAgent.DataTextField = "ContactName";
            cboAgent.DataValueField = "ContactID";
            cboAgent.DataSource = clsContact.AgentsAsDataTable(txtAgent.Text, 0, "ContactName", SortOption.Ascending);
            cboAgent.DataBind();
            if (string.IsNullOrEmpty(txtAgent.Text))
                cboAgent.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboAgent.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtAgent.Text, Constants.ZERO_STRING));
            cboAgent.SelectedIndex = 0;

            Terminal clsTerminal = new Terminal(clsCustomer.Connection, clsCustomer.Transaction);
            cboTerminalNo.DataTextField = "TerminalNo";
            cboTerminalNo.DataValueField = "TerminalNo";
            cboTerminalNo.DataSource = clsTerminal.ListAsDataTable();
            cboTerminalNo.DataBind();
            cboTerminalNo.Items.Insert(0, new ListItem(Constants.ALL, Constants.ALL));
            cboTerminalNo.SelectedIndex = 0;

            Branch clsBranch = new Branch(clsCustomer.Connection, clsCustomer.Transaction);
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranch.DataBind();
            cboBranch.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboBranch.SelectedIndex = 0;

            Security.AccessUser clsAccessUser = new Security.AccessUser(clsCustomer.Connection, clsCustomer.Transaction);
            cboCashierName.DataTextField = "Name";
            cboCashierName.DataValueField = "UID";
            cboCashierName.DataSource = clsAccessUser.Cashiers(txtCashierName.Text, 0);
            cboCashierName.DataBind();
            if (string.IsNullOrEmpty(txtCashierName.Text))
                cboCashierName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboCashierName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtCashierName.Text, Constants.ZERO_STRING));
            cboCashierName.SelectedIndex = 0;

            ProductGroup clsProductGroup = new ProductGroup(clsCustomer.Connection, clsCustomer.Transaction);
            cboProductGroup.DataTextField = "ProductGroupName";
            cboProductGroup.DataValueField = "ProductGroupName";
            cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName");
            cboProductGroup.DataBind();
            cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboProductGroup.SelectedIndex = 0;
            clsCustomer.CommitAndDispose();

            #region Sales Per Day
            cboMonth.Items.Add(new ListItem("January", "1"));
            cboMonth.Items.Add(new ListItem("February", "2"));
            cboMonth.Items.Add(new ListItem("March", "3"));
            cboMonth.Items.Add(new ListItem("April", "4"));
            cboMonth.Items.Add(new ListItem("May", "5"));
            cboMonth.Items.Add(new ListItem("June", "6"));
            cboMonth.Items.Add(new ListItem("July", "7"));
            cboMonth.Items.Add(new ListItem("August", "8"));
            cboMonth.Items.Add(new ListItem("September", "9"));
            cboMonth.Items.Add(new ListItem("October", "10"));
            cboMonth.Items.Add(new ListItem("November", "11"));
            cboMonth.Items.Add(new ListItem("Decemeber", "12"));
            cboMonth.SelectedIndex = DateTime.Now.Month - 1;

            int x = 2007;
            while (x <= DateTime.Now.Year)
            {
                cboYear.Items.Add(new ListItem(x.ToString(), x.ToString()));
                x++;
            }
            cboYear.SelectedIndex = cboYear.Items.Count - 1;
            #endregion

        }
示例#29
0
		private void LoadOptions()
		{
            if (mboIsPriceInq)
                this.lblHeader.Text = "Item: Price Inquiry";
            else
                this.lblHeader.Text = "Select Item to purchase";

            ProductGroup clsProductGroup = new ProductGroup();
            System.Data.DataTable dtaProductGroup = clsProductGroup.ListAsDataTable(SortField:"ProductGroupCode");
            clsProductGroup.CommitAndDispose();

            lstGroup.Items.Clear(); int iImgCtr = 0;
            foreach(System.Data.DataRow dr in dtaProductGroup.Rows)
            {
                lstGroup.Items.Add(dr["ProductGroupCode"].ToString(),dr["ProductGroupCode"].ToString(),iImgCtr);
                if (iImgCtr == 7) iImgCtr = 0; else iImgCtr++;
            }
            try {   lstGroup.Items[0].Selected = true;  }catch { }
		}
示例#30
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();

			lblGroupID.Text = Common.Decrypt((string)Request.QueryString["groupid"],Session.SessionID);
			lblMatrixID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID);

			ProductGroupVariations clsProductGroupVariation = new ProductGroupVariations();
			lstItem.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupVariation.List(Convert.ToInt32(lblGroupID.Text),"VariationType",SortOption.Ascending)).DefaultView;
			lstItem.DataBind();
			clsProductGroupVariation.CommitAndDispose();

            Data.Unit clsUnit = new Data.Unit();
			cboUnit.DataTextField = "UnitName";
			cboUnit.DataValueField = "UnitID";
			cboUnit.DataSource = clsUnit.ListAsDataTable(SortField:"UnitName").DefaultView;
			cboUnit.DataBind();
			cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
			clsUnit.CommitAndDispose();	
	
			ProductGroup clsProductGroup = new ProductGroup();
			ProductGroupDetails clsProductGroupDetails = clsProductGroup.Details(Convert.ToInt32(lblGroupID.Text));
			cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsProductGroupDetails.UnitDetails.UnitID.ToString()));
			txtProductPrice.Text = clsProductGroupDetails.Price.ToString("#,##0.#0");
			txtPurchasePrice.Text = clsProductGroupDetails.PurchasePrice.ToString("#,##0.#0");
            chkIncludeInSubtotalDiscount.Checked = clsProductGroupDetails.IncludeInSubtotalDiscount;
			txtVAT.Text = clsProductGroupDetails.VAT.ToString("#,##0.#0");
			txtEVAT.Text = clsProductGroupDetails.EVAT.ToString("#,##0.#0");
			txtLocalTax.Text = clsProductGroupDetails.LocalTax.ToString("#,##0.#0");
		}